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