Bug #78529 [Opn]: Internal Array Pointer still points to NULL after adding element

From: Date: Thu, 12 Sep 2019 16:07:12 +0000
Subject: Bug #78529 [Opn]: Internal Array Pointer still points to NULL after adding element
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222706@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78529&edit=1 ID: 78529 Updated by: requinix@php.net Reported by: philipp at atelierdisko dot de Summary: Internal Array Pointer still points to NULL after adding element Status: Open Type: Bug Package: Arrays related Operating System: Linux & Darwin PHP Version: 7.3.9 Block user comment: N Private report: N New Comment: Is this documented behavior? Previous Comments: ------------------------------------------------------------------------ [2019-09-12 15:35:41] philipp at atelierdisko dot de Description: ------------ This problem occurs in Version 7.3.0 - 7.40beta4. Steps to reproduce: 1. Have an array $a with elements and integer keys 2. Let the internal pointer point beyond the end of the elements list using next($a) 3. Set a value by key where key is lower then the lowest existing key in $a 4. Call key($a) I expect key($a) to return the key of the element I just added (like it did before 7.3.0), but it returns null. I have prepared a 3v4l script that shows the problem: https://3v4l.org/DoFve Thanks for having a look at this. I can provide more context if needed. Test script: --------------- $data = [1 => true]; next($data); var_dump(key($data)); $data[0] = true; var_dump(key($data)); Expected result: ---------------- NULL int(0) Actual result: -------------- NULL NULL ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78529&edit=1

« previous php.bugs (#222706) next »