#24710 [Ver]: $obj->foo = "bar"; print $obj->{0}; segfaults
| From: | meebey@php.net | Date: | Fri, 18 Jul 2003 23:33:31 +0000 |
| Subject: | #24710 [Ver]: $obj->foo = "bar"; print $obj->{0}; segfaults | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-44274@lists.php.net to get a copy of this message | ||
ID: 24710
Updated by: meebey@php.net
Reported By: swalk at prp dot physik dot tu-darmstadt dot de
Status: Verified
Bug Type: Reproducible crash
Operating System: Any
PHP Version: 4.3.2
New Comment:
I just rechecked my error reporting level on my PHP5 installation. With
PHP 5.0.0b1 the bevahior of this code is right. I get the same output
as <swalk at prp dot physik dot tu-darmstadt dot de> with his PHP
5.0.0b2.
Previous Comments:
------------------------------------------------------------------------
[2003-07-18 18:14:11] swalk at prp dot physik dot tu-darmstadt dot de
Okay, php5(b2) does it right, you get a
Notice: Undefined property: stdClass::$0 in Command line code on line
1
when doing that.
It also only segfaults when you put a literal int or float into the
braces. If you put a variable containing an int or float in there it
works as expected...
------------------------------------------------------------------------
[2003-07-18 18:05:17] swalk at prp dot physik dot tu-darmstadt dot de
hmm. my fault, it doesn't segfault in 5.0.0b2 - i must have been in the
wrong directory when i tried to check.
------------------------------------------------------------------------
[2003-07-18 18:01:26] meebey@php.net
ups, I made a typo in the 2. testscript,
it should be "var $foo;" instead of "var foo;"
it also segfaults...
------------------------------------------------------------------------
[2003-07-18 17:57:46] meebey@php.net
I could reproduce this behavior with PHP 4.3.0, 4.3.1, 4.3.2, 4.2.3.
With 5.0.0b1 it doesn't segfault but shows no output neither a warning
or fatal.
With this code instead it works like expected:
<?php
class test
{
var foo;
}
$obj = &new test();
$obj->foo = "bar";
print $obj->{0};
?>
Outputs:
PHP Parse error: parse error, expecting `T_VARIABLE' in
/home/meebey/phpbug.php on line 4
------------------------------------------------------------------------
[2003-07-18 17:30:18] swalk at prp dot physik dot tu-darmstadt dot de
sorry, mozillas cache was messing up.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/24710
--
Edit this bug report at http://bugs.php.net/?id=24710&edit=1