php-src/ext/tidy/tests/parsing_inexistent_file.phpt
George Peter Banyard 704aadd098
Fix memory leaks in ext-tidy
We must not instantiate the object prior checking error conditions
Moreover, we need to release the HUGE amount of memory for files which are over 4GB when throwing a ValueError

Closes GH-10545
2023-02-10 14:12:23 +00:00

22 lines
559 B
PHP

--TEST--
Trying to parse a non existent file
--EXTENSIONS--
tidy
--FILE--
<?php
$tidy = new tidy;
var_dump($tidy->parseFile("does_not_exist.html"));
var_dump(tidy_parse_file("does_not_exist.html"));
$tidy = new tidy("does_not_exist.html");
?>
--EXPECTF--
Warning: tidy::parseFile(): Cannot load "does_not_exist.html" into memory in %s on line %d
bool(false)
Warning: tidy_parse_file(): Cannot load "does_not_exist.html" into memory in %s on line %d
bool(false)
Warning: tidy::__construct(): Cannot load "does_not_exist.html" into memory in %s on line %d