Doc #75947 [NEW]: Tidy creates an undocumented property Tidy->value after calling parseString()
| From: | tandre at themeetgroup dot com | Date: | Sat, 10 Feb 2018 20:02:15 +0000 |
| Subject: | Doc #75947 [NEW]: Tidy creates an undocumented property Tidy->value after calling parseString() | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-15421@lists.php.net to get a copy of this message | ||
From: tandre at themeetgroup dot com
Operating system:
PHP version: Irrelevant
Package: Tidy
Bug Type: Documentation Problem
Bug description:Tidy creates an undocumented property Tidy->value after calling parseString()
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>
--
Edit bug report at https://bugs.php.net/bug.php?id=75947&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75947&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75947&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75947&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75947&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75947&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75947&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75947&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75947&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75947&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75947&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75947&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75947&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75947&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75947&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75947&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75947&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75947&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75947&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75947&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75947&r=mysqlcfg