php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37144 PHP crashes trying to assign into property of dide object
Submitted: 2006-04-20 08:30 UTC Modified: 2006-07-19 14:05 UTC
From: [email protected] Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.1.2 OS: *
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: [email protected]
New email:
PHP Version: OS:

 

 [2006-04-20 08:30 UTC] [email protected]
Description:
------------
PHP removes a temorary object then tryes to assign into its property. As a result we have SIGSEGV.

Reproduce code:
---------------
<?php
function foo() {
  $x = new stdClass();
  $x->bar = array(1);
  return $x;
}
foo()->bar[1] = "123";
echo "ok\n";
?>

Expected result:
----------------
ok

Actual result:
--------------
crash and/or memory leaks

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-20 13:09 UTC] smlerman at gmail dot com
I don't get a segfault on Windows 5.1.1, Linux 5.1.1 (compiled on Ubuntu), or Linux 5.1.2 (compiled on Fedora).

As a side note, should that even be valid syntax? Shouldn't the left side of assignment only allow variables (other than the special language construct list())? Isn't foo()->bar[1] an expression, not a variable?
 [2006-04-20 16:58 UTC] [email protected]
PHP always segfaults with this script if it is compied with --enable-debug.
 [2006-07-19 14:05 UTC] [email protected]
Fixed in CVS HEAD and PHP_5_2.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Dec 07 22:00:01 2025 UTC