Bug #77278 [NEW]: libtidy 5.6 changes behavior of casting results

From: Date: Mon, 10 Dec 2018 16:55:13 +0000
Subject: Bug #77278 [NEW]: libtidy 5.6 changes behavior of casting results
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218372@lists.php.net to get a copy of this message
From: spam2 at rhsoft dot net Operating system: PHP version: Irrelevant Package: Scripting Engine problem Bug Type: Bug Bug description:libtidy 5.6 changes behavior of casting results Description: ------------ i doubt that it is expected behavior when some buggy library seems to play around with LOCALE that unformatted output of float vars changes from dot to a comma $pages_summary = (string)($count_summary / 3); echo "PAGES-SUMMARY: $pages_summary\n"; https://github.com/htacg/tidy-html5/issues/780#issuecomment-445885150 libtidy-5.6.0-2.fc28.x86_64.rpm [harry@srv-rhsoft:~]$ php /downloads/tidy-debug.php PAGES-SUMMARY: 3,3333333333333 PAGES-SUMMARY: 3,3333333333333 CORRUPTION! libtidy-5.4.0-4.fc28.20181003.rh.x86_64.rpm [harry@srv-rhsoft:~]$ php /downloads/tidy-debug.php PAGES-SUMMARY: 3.3333333333333 PAGES-SUMMARY: 4 OK Test script: --------------- libtidy 5.6 is touching LOCALE somewhere without a proper reset - period look at the comma instad dot after typecasting a float value libtidy-5.6.0-2.fc28.x86_64.rpm [harry@srv-rhsoft:~]$ php /downloads/tidy-debug.php PAGES-SUMMARY: 3,3333333333333 PAGES-SUMMARY: 3,3333333333333 CORRUPTION! libtidy-5.4.0-4.fc28.20181003.rh.x86_64.rpm [harry@srv-rhsoft:~]$ php /downloads/tidy-debug.php PAGES-SUMMARY: 3.3333333333333 PAGES-SUMMARY: 4 OK /** comment out this line and everything is fine with libtidy-5.6.0-2.fc28.x86_64 too */ $tidy = tidy_parse_string('bla', [], 'latin1'); /** that code is completly unrelated to tidy and must not change it's behavior */ $conn = mysqli_init(); mysqli_real_connect($conn, $host, $user, $pwd, $db); $result = mysqli_query($conn, "select SQL_CALC_FOUND_ROWS * from cl_autotest_youtube_items where yi_cid='1' and yi_aktiv='1' order by yi_sort asc limit 0, 3"); $count_summary = mysqli_fetch_row(mysqli_query($conn, 'select SQL_NO_CACHE found_rows()'))[0]; $pages_summary = (string)($count_summary / 3); echo "PAGES-SUMMARY: $pages_summary\n"; if($pages_summary > (int)$pages_summary) { $pages_summary = (int)$pages_summary + 1; } echo "PAGES-SUMMARY: $pages_summary\n"; if((int)$pages_summary !== 4) { echo "CORRUPTION!\n"; } else { echo "OK\n"; } Expected result: ---------------- PAGES-SUMMARY: 3.3333333333333 PAGES-SUMMARY: 4 Actual result: -------------- PAGES-SUMMARY: 3,3333333333333 PAGES-SUMMARY: 3,3333333333333 CORRUPTION! -- Edit bug report at https://bugs.php.net/bug.php?id=77278&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77278&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77278&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77278&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77278&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77278&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77278&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77278&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77278&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77278&r=support Expected behavior: https://bugs.php.net/fix.php?id=77278&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77278&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77278&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77278&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77278&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77278&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77278&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77278&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77278&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77278&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77278&r=mysqlcfg

« previous php.bugs (#218372) next »