Bug #75164 [Opn->Csd]: split_bc_num() is pointless
| From: | cmb@php.net | Date: | Mon, 18 Sep 2017 13:25:15 +0000 |
| Subject: | Bug #75164 [Opn->Csd]: split_bc_num() is pointless | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-211211@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75164&edit=1
ID: 75164
Updated by: cmb@php.net
Reported by: cmb@php.net
Summary: split_bc_num() is pointless
-Status: Open
+Status: Closed
Type: Bug
Package: BC math related
Operating System: *
PHP Version: 7.0.23
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Fixed with <http://git.php.net/?p=php-src.git;a=commit;h=870ed5106d6274905b5aa4341429deef12c92e55>.
Previous Comments:
------------------------------------------------------------------------
[2017-09-06 12:17:35] cmb@php.net
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 this bug report at https://bugs.php.net/bug.php?id=75164&edit=1