[suspicious - maybe spam] #31451 [Opn->Asn]: __call can not work with __get

From: Date: Fri, 21 Jan 2005 12:05:45 +0000
Subject: [suspicious - maybe spam] #31451 [Opn->Asn]: __call can not work with __get
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-72586@lists.php.net to get a copy of this message
 ID:               31451
 Updated by:       sniper@php.net
 Reported By:      syre at citiz dot net
-Status:           Open
+Status:           Assigned
 Bug Type:         Scripting Engine problem
-Operating System: win2k pro sp4
+Operating System: *
 PHP Version:      4CVS-2005-01-18
-Assigned To:      
+Assigned To:      stas
 New Comment:

Yet another overload bug.



Previous Comments:
------------------------------------------------------------------------

[2005-01-11 04:08:44] syre at citiz dot net

<?php
class ObjectShell {
	var $_target;
	
	function ObjectShell(&$target) {
		$this->_target=$target;
		overload('ObjectShell');
	}

	function __get($name, &$value) {
		return true;	
	}

	function __set($name, $value) {
		return true;
	}
	
	function __call($func, $args, &$return) {
		$return=1;
		return true;
	}

	function func1(){
		echo "func1() called ";
		return $this->_target->func1();
	}
}

class Test {
	function func1() {
		return 2;
	}
}

$t=new Test;
$p=new ObjectShell($t);
//this will work
echo $p->func1();
echo "<br>\n";

//this will result "stack overflow" on php4.3.10
//if remove ObjectShell::__set, 
//or ObjectShell::__func1()
//or replace ObjectShell::func1() 
//with func1($a, $b){ return 1 } 
//it will also ok

?>

------------------------------------------------------------------------

[2005-01-08 12:18:49] syre at citiz dot net

Description:
------------
//that will ok
echo $p->var1;
echo "<br>\n";
echo $p->func1(9,7);

//that will cost script time out
//the same code will ok on 4.3.8 / 4.3.2
echo $p->func1(9,7);
echo "<br>\n";
echo $p->var1;

Reproduce code:
---------------
http://community.csdn.net/Expert/topic/3707/3707113.xml?temp=.141308



Expected result:
----------------
1024<br>
16<br>
16<br>
1024

Actual result:
--------------
script time out


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31451&edit=1


Thread (10 messages)

« previous php.bugs (#72586) next »