|  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: Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.1.2 OS: *
Private report: No CVE-ID: None
 [2006-04-20 08:30 UTC]
PHP removes a temorary object then tryes to assign into its property. As a result we have SIGSEGV.

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

Expected result:

Actual result:
crash and/or memory leaks


Add a Patch

Pull Requests

Add a Pull Request


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]
PHP always segfaults with this script if it is compied with --enable-debug.
 [2006-07-19 14:05 UTC]
Fixed in CVS HEAD and PHP_5_2.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 23 20:01:23 2020 UTC