File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / tidy / tests / 027.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:05 2012 UTC (12 years, 8 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Bug: tidy segfaults with markup=false
--SKIPIF--
<?php if (!extension_loaded('tidy')) die('skip'); ?>
--FILE--
<?php

// bug report from http://sf.net/tracker/?func=detail&atid=390963&aid=1641868&group_id=27659

abstract class BaseClass {
        private static $tidyconfig;

        public function BaseClass() {
                $this->tidyconfig = array(
                        'indent'                        => false,
                        'clean'                         => true,
                        'merge-divs'            => false,
                        'quote-marks'           => true,
                        'drop-empty-paras'      => false,
                        'markup'                        => false,
                        'output-xhtml'          => true,
                        'wrap'                          => 0);

        }

        abstract public function run();

        public function getURL($url) {
                $data = "awerawer"; // in my code, $data is downloaded from a site

                $tidy = new tidy;
                $tidy->parseString($data, $this->tidyconfig, 'utf8');
                $tidy->cleanRepair();

                return $tidy;
        }

}

class ChildClass extends BaseClass {
        public function ChildClass() {
                parent::__construct();
        }

        public function run() {
                $result = $this->getURL('awer');
                if ($result === null) {
                        echo "\tError:\n";
                }
                var_dump((string)$result);
        }
}

$instance = new ChildClass();
$instance->run();

?>
--EXPECT--
string(0) ""

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>