php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6239 object comparison w circular references leads to crash
Submitted: 2000-08-18 11:44 UTC Modified: 2001-07-15 14:54 UTC
From: waldschrott@php.net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Latest CVS (18/08/2000) OS: w2k, maybe all
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: waldschrott@php.net
New email:
PHP Version: OS:

 

 [2000-08-18 11:44 UTC] waldschrott@php.net
got another one ;)
of course this example is *extremely* different from my
example and I don?t know how we could handle circular
references in ordered and unordered comparisions with ease,
but *it should not crash* (taken from zeev) although it?d
expect it to... :)

$obj->a='1';
$obj->b='2';

$obj2->b='2';
$obj2->a='1';
$obj2->c=&$obj;
$obj->c=&$obj2;
		
echo $obj==$obj2;
echo $obj===$obj2;

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-18 17:01 UTC] stas@php.net
Confirmed on latest CVS. Will look into it.
 [2000-11-27 05:25 UTC] sniper@php.net
Isn't this fixed already?

--Jani
 [2000-11-27 06:22 UTC] waldschrott@php.net
no, still crashes w latest cvs
 [2000-12-30 12:04 UTC] sniper@php.net
And crashes with Linux too..

--Jani
 [2001-04-28 12:59 UTC] jmoore@php.net
<?php

class object1 {
  var $a;
  var $b;
  var $c;
}

$obj = new object1();
$obj2 = new object1();


$obj->a='1';
$obj->b='2';

$obj2->b='2';
$obj2->a='1';
$obj2->c=&$obj;
$obj->c=&$obj2;
		
echo ($obj==$obj2)?1:2;
echo ($obj===$obj2)?1:2;

?>

still causes a stack overflow error. Perhaps we need to limit the depth the comparison follows too.
 [2001-07-15 14:54 UTC] zeev@php.net
Fixed in the latest CVS (properly bails out) - will be a part of 4.0.7.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 24 16:01:31 2024 UTC