|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49866 Making reference on string offsets crashes PHP
Submitted: 2009-10-13 16:08 UTC Modified: 2009-12-07 08:47 UTC
From: doctorrock83 at gmail dot com Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.0 OS: Linux
Private report: No CVE-ID: None
 [2009-10-13 16:08 UTC] doctorrock83 at gmail dot com
When making a reference on a string offset and changing it, PHP5.3 crashes with segfault, but PHP 5.2, 5.1 and 5.0 throws errors.

I know that it's a bad PHP programming than thinking PHP is C, the fact is that this behavior gives PHP errors in 5.2/5.1/5.0 branches, but segfaults 5.3.0 release.

Reproduce code:
$a = "string";
$b = &$a[1];
$b = "f";
echo $a;

Expected result:

But PHP5.2.0 and 5.0.0 tell :
"Fatal error: Cannot create references to/from string offsets nor overloaded objects in XXX"

PHP 5.1.0 tells:
"Fatal error: fatal flex scanner internal error--end of buffer missed in XXX"

PHP5.3 segfaults

Actual result:
segmentation faults


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-13 17:30 UTC]
Dmitry, this is related to rev.251187 and rev.244680 (fix for #35163)
 [2009-12-07 08:47 UTC]
Automatic comment from SVN on behalf of dmitry
Log: Fixed bug #49866 (Making reference on string offsets crashes PHP)
 [2009-12-07 08:47 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Mar 22 12:01:27 2019 UTC