Bug #75164 [NEW]: split_bc_num() is pointless

From: Date: Wed, 06 Sep 2017 12:17:43 +0000
Subject: Bug #75164 [NEW]: split_bc_num() is pointless
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210973@lists.php.net to get a copy of this message
From: cmb Operating system: * PHP version: 7.0.23 Package: BC math related Bug Type: Bug Bug description:split_bc_num() is pointless Description: ------------ The fix for bug #72093 introduced split_bc_num(), but this function appears to be pointless, because it returns its input if the refcount is greater than or equal 1[1] (what' most likely always true). Even if the split would be done if the refcount is greater than 1, it appears that the shallow copy[2] would not be sufficient anyway, since bc_struct holds pointers to strings[3] which would still be shared. I have not been able to come up with a test case showing the assumed misbehavior. Actually, all tests still pass (even with valgrind enabled), if the function's body is changed to always return num. [1] <https://github.com/php/php-src/blob/php-7.2.0RC1/ext/bcmath/bcmath.c#L214-L216> [2] <https://github.com/php/php-src/blob/php-7.2.0RC1/ext/bcmath/bcmath.c#L218> [3] <https://github.com/php/php-src/blob/php-7.2.0RC1/ext/bcmath/libbcmath/src/bcmath.h#L46-L52> -- Edit bug report at https://bugs.php.net/bug.php?id=75164&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75164&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75164&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75164&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=75164&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=75164&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=75164&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=75164&r=needscript Try newer version: https://bugs.php.net/fix.php?id=75164&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=75164&r=support Expected behavior: https://bugs.php.net/fix.php?id=75164&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=75164&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=75164&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=75164&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75164&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=75164&r=dst IIS Stability: https://bugs.php.net/fix.php?id=75164&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=75164&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=75164&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=75164&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=75164&r=mysqlcfg

« previous php.bugs (#210973) next »