Bug #73753 [Opn->Ver]: unserialized array pointer not advancing

From: Date: Fri, 16 Dec 2016 14:47:17 +0000
Subject: Bug #73753 [Opn->Ver]: unserialized array pointer not advancing
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206068@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73753&edit=1 ID: 73753 Updated by: cmb@php.net Reported by: devosc at gmail dot com Summary: unserialized array pointer not advancing -Status: Open +Status: Verified Type: Bug Package: Scripting Engine problem PHP Version: 7.1.0 Block user comment: N Private report: N New Comment: Confirmed: <https://3v4l.org/QmfJM#v563>. Previous Comments: ------------------------------------------------------------------------ [2016-12-15 19:14:33] devosc at gmail dot com Description: ------------ Internal pointer of unserialized array does not advance correctly. Test script: --------------- <?php function iterate($current, $queue, $result = null) { if (!$current) { return $result; } return iterate(step($queue), $queue, $current); } function step(&$queue) { return next($queue); } function start($queue) { return current($queue); } function traverse($queue) { return iterate(start($queue), $queue); } $queue = ['foo', 'bar', 'baz']; $queue = unserialize(serialize($queue)); echo traverse($queue); //baz Expected result: ---------------- It should output 'baz'. Actual result: -------------- Recursion error. The internal pointer is stuck on the second item and does not move forward. It works in 5.6 and when $queue is a reference in the signature of the iterate function. Seems inconsistent. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73753&edit=1

« previous php.bugs (#206068) next »