Bug #63315 [Csd]: BitSet::fromArray modifies original array value if a non-integer is supplied

From: Date: Thu, 25 May 2023 06:31:31 +0000
Subject: Bug #63315 [Csd]: BitSet::fromArray modifies original array value if a non-integer is supplied
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244521@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63315&edit=1 ID: 63315 Updated by: remi@php.net Reported by: willfitch@php.net Summary: BitSet::fromArray modifies original array value if a non-integer is supplied Status: Closed Type: Bug -Package: Bitset +Package: *General Issues Operating System: Linux PHP Version: Irrelevant -Assigned To: willfitch +Assigned To: remi Block user comment: N Private report: N New Comment: Fixed upstream (will be in 3.1.0) Previous Comments: ------------------------------------------------------------------------ [2023-05-24 14:00:38] git@php.net Automatic comment on behalf of cmb69 (author) and remicollet (committer) Revision: https://github.com/php/pecl-numbers-bitset/commit/11bad9e1ffe0c37fd47e40505eea80e6b98c3650 Log: Fix #63315: BitSet::fromArray may modify original array value ------------------------------------------------------------------------ [2020-12-23 14:10:31] cmb@php.net The following pull request has been associated: Patch Name: Fix #63315: BitSet::fromArray may modify original array value On GitHub: https://github.com/php/pecl-numbers-bitset/pull/13 Patch: https://github.com/php/pecl-numbers-bitset/pull/13.patch ------------------------------------------------------------------------ [2020-09-22 15:30:17] cmb@php.net The problem is that the array elements are convert_to_long(), what modifies the zvals in the array. As a quick fix, separating the array in zpp() should solve that. ------------------------------------------------------------------------ [2012-10-19 18:21:03] willfitch@php.net Description: ------------ When passing an array to BitSet::fromArray, the original array is modified when any of the values in the array are non-long. Test script: --------------- <?php $arr = array(5, 6, '7'); var_dump($arr); BitSet::fromArray($arr); var_dump($arr); ?> Expected result: ---------------- array(3) { [0]=> int(5) [1]=> int(6) [2]=> string(1) "7" } Actual result: -------------- array(3) { [0]=> int(5) [1]=> int(6) [2]=> int(7) } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63315&edit=1

« previous php.bugs (#244521) next »