|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41506 reassining string index to '' doesn't cause string length update
Submitted: 2007-05-26 10:14 UTC Modified: 2007-05-26 12:26 UTC
From: shugotenshi at gmail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.2.2 OS: Linux (Ubuntu 7.04)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: shugotenshi at gmail dot com
New email:
PHP Version: OS:


 [2007-05-26 10:14 UTC] shugotenshi at gmail dot com
PHP Version 5.2.1 (form wouldn't let me select this version)

Reassigning a string index to ''
doesn't modify the string's length.

Reproduce code:
$ php -r '$str = "foo"; $str{0} = ""; var_dump($str);'

Expected result:
string(2) "oo"

Actual result:
string(3) "oo"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-26 12:26 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

The first character will be a Null-Byte after that operation which is not shown by your terminal/browser/... 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 01:01:33 2024 UTC