|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-02-10 20:02 UTC] tandre at themeetgroup dot com
Description: ------------ The test script shows that $x->value is indeed being created after calling parseString. This property seems like it is created in all versions from PHP 5.0 to 7.2 (haven't checked earlier versions) https://github.com/php/php-src/blob/PHP-5.0/ext/tidy/tidy.c#L685-L690 https://github.com/php/php-src/blob/PHP-7.2.2/ext/tidy/tidy.c#L820-L827 However, Tidy->value is not mentioned in any of the following places: - https://secure.php.net/manual/en/class.tidy.php#tidy.synopsis - https://secure.php.net/manual/en/tidy.parsestring.php#refsect1-tidy.parsestring-examples does not mention that $tidy->value would be created. Also, I'm wondering it it would make sense to deprecate attempts to access Tidy->value in PHP 7.3: - It's undocumented, so not many applications would use it (hopefully) - It's inefficient to generate HTML/XML strings which which won't be used - Not sure if generating the string affects Tidy->errorBuffer. I discovered this when investigating a bug in php's use of tidy-html5 5.6.0 (worked in 5.4.0): https://github.com/htacg/tidy-html5/issues/673#issuecomment-364683244 - Feel free to file a new issue for that if it makes sense to? I wasn't sure. Test script: --------------- $x = new Tidy(); $x->parseString('<p>example</p>', ['show-body-only'=>true]); printf("Value property: %s\n", $x->value); // $x->value exists after calling parseString/parseFile, but printf("cast to (string): %s\n", (string)$x); Expected result: ---------------- I expect the existence of the property Tidy->value to be documented on php.net (Or to be deprecated in php 7.3 and removed in 8.0) Actual result: -------------- Tidy->value is not documented, but exists. The above test script outputs the following: Value property: <p>example</p> cast to (string): <p>example</p> PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 17:00:01 2025 UTC |
> The test script shows that $x->value is indeed being created > after calling parseString. Actually, the `value` property is already created when the tidy object is instantiated. POC: <?php $x = new tidy; var_dump( property_exists('tidy', 'value'), property_exists($x, 'value) ); gives bool(false) bool(true)