php.net |  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
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.0 OS: Linux
Private report: No CVE-ID:
 [2009-10-13 16:08 UTC] doctorrock83 at gmail dot com
Description:
------------
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:
---------------
<?php
$a = "string";
$b = &$a[1];
$b = "f";
echo $a;

Expected result:
----------------
sfring

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-13 17:30 UTC] felipe@php.net
Dmitry, this is related to rev.251187 and rev.244680 (fix for #35163)
 [2009-12-07 08:47 UTC] svn@php.net
Automatic comment from SVN on behalf of dmitry
Revision: http://svn.php.net/viewvc/?view=revision&revision=291810
Log: Fixed bug #49866 (Making reference on string offsets crashes PHP)
 [2009-12-07 08:47 UTC] dmitry@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 23 18:01:55 2014 UTC