|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73104 next causes fatal error on constant array
Submitted: 2016-09-18 08:03 UTC Modified: 2016-09-18 16:14 UTC
From: jerry at jmweb dot net Assigned: cmb (profile)
Status: Not a bug Package: Arrays related
PHP Version: 5.6.26 OS: Windows 7 Pro 64bit
Private report: No CVE-ID: None
 [2016-09-18 08:03 UTC] jerry at jmweb dot net
When creating an array constant, the next() function generates a fatal error.

The key() and current() functions work as expected.

Test script:
const ARRAY_BUG = [ 1, 2 ];

  key(     ARRAY_BUG ),
  current( ARRAY_BUG ),
  next(    ARRAY_BUG )

Expected result:

Actual result:
Fatal error: Only variables can be passed by reference in ...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-09-18 16:14 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2016-09-18 16:14 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

next() is supposed to change the array internally, but constant
array can't be changed.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Aug 06 02:01:24 2020 UTC