xref: /PHP-8.1/ext/tidy/tests/027.phpt (revision 7f2f0c00)
1--TEST--
2Bug: tidy segfaults with markup=false
3--EXTENSIONS--
4tidy
5--FILE--
6<?php
7
8// bug report from http://sf.net/tracker/?func=detail&atid=390963&aid=1641868&group_id=27659
9
10abstract class BaseClass {
11        private static $tidyconfig;
12
13        public function __construct() {
14                self::$tidyconfig = array(
15                        'indent'                        => false,
16                        'clean'                         => true,
17                        'merge-divs'            => false,
18                        'quote-marks'           => true,
19                        'drop-empty-paras'      => false,
20                        'markup'                        => false,
21                        'output-xhtml'          => true,
22                        'wrap'                          => 0);
23
24        }
25
26        abstract public function run();
27
28        public function getURL($url) {
29                $data = "awerawer"; // in my code, $data is downloaded from a site
30
31                $tidy = new tidy;
32                $tidy->parseString($data, self::$tidyconfig, 'utf8');
33                $tidy->cleanRepair();
34
35                return $tidy;
36        }
37
38}
39
40class ChildClass extends BaseClass {
41        public function __construct() {
42                parent::__construct();
43        }
44
45        public function run() {
46                $result = $this->getURL('awer');
47                if ($result === null) {
48                        echo "\tError:\n";
49                }
50                var_dump((string)$result);
51        }
52}
53
54$instance = new ChildClass();
55$instance->run();
56
57?>
58--EXPECT--
59string(0) ""
60