Bug #78529 [NEW]: Internal Array Pointer still points to NULL after adding element
| From: | philipp at atelierdisko dot de | Date: | Thu, 12 Sep 2019 15:35:41 +0000 |
| Subject: | Bug #78529 [NEW]: Internal Array Pointer still points to NULL after adding element | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-222705@lists.php.net to get a copy of this message | ||
From: philipp at atelierdisko dot de
Operating system: Linux & Darwin
PHP version: 7.3.9
Package: Arrays related
Bug Type: Bug
Bug description:Internal Array Pointer still points to NULL after adding element
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 bug report at https://bugs.php.net/bug.php?id=78529&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78529&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78529&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78529&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78529&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78529&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78529&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78529&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78529&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78529&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78529&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78529&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78529&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78529&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78529&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78529&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78529&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78529&r=mysqlcfg