PHP 4.0 Bug #7061 Updated: assigning a reference to a member of string

From: Date: Fri, 06 Oct 2000 17:39:45 +0000
Subject: PHP 4.0 Bug #7061 Updated: assigning a reference to a member of string
Groups: php.dev 
Request: Send a blank email to php-dev+get-34381@lists.php.net to get a copy of this message
ID: 7061 Updated by: andi Reported By: panu.kalliokoski@giro.fi Status: Closed Bug Type: Reproduceable crash Assigned To: Comments: Thanks, I just fixed this in the latest CVS. It bails out with an error. I agree with you about string indexing which is mixed with array offsets syntax being a misfeature. It is due to backwards comaptibility. I have on my TODO list to add a new syntax for string indexing in order to split up these two. But we will need to anyway keep the current behavior because too many scripts in the world rely on it. Previous Comments: --------------------------------------------------------------------------- [2000-10-06 23:36:19] panu.kalliokoski@giro.fi This has also been tested with php-4.0.2. The simplest script I could come up with to produce the core dump is like this: $a = 'string'; $str = 'another one'; $a[0] =& $str; This will cause a core dump. String indexing, IMO, is a misfeature only causing harm. What I find especially irritating is that if I index a string by string index, by accident, it automagically casts the string index to a numeric one. None of my business, of course. Panu Kalliokoski --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=7061

« previous php.dev (#34381) next »