php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31451 __call can not work with __get (works in PHP 5.1)
Submitted: 2005-01-08 12:18 UTC Modified: 2008-07-11 21:11 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: syre at citiz dot net Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 4CVS-2005-01-18 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: syre at citiz dot net
New email:
PHP Version: OS:

 

 [2005-01-08 12:18 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-11 04:08 UTC] 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

?>
 [2008-07-11 21:11 UTC] jani@php.net
We are sorry, but we can not support PHP 4 related problems anymore.
Momentum is gathering for PHP 6, and we think supporting PHP 4 will
lead to a waste of resources which we want to put into getting PHP 6
ready.


 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Aug 11 18:03:36 2022 UTC