#45467 [Opn->Ver]: Empty reply from server when invoking dynamic method name within class

From: Date: Thu, 10 Jul 2008 10:27:23 +0000
Subject: #45467 [Opn->Ver]: Empty reply from server when invoking dynamic method name within class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-126434@lists.php.net to get a copy of this message
 ID:               45467
 Updated by:       jani@php.net
 Reported By:      thijs dot wijnmaalen at gmail dot com
-Status:           Open
+Status:           Verified
 Bug Type:         Scripting Engine problem
 Operating System: Mac OS X
 PHP Version:      5.2.6
 New Comment:

It actually crashes, here's relevant part from valgrind:

==1178== Process terminating with default action of signal 11
(SIGSEGV)
==1178==  Access not within mapped region at address 0xBE1A0FFC
==1178==    at 0x823AF25: zend_get_property_info
(zend_object_handlers.c:179)
==1178== Stack overflow in thread 1: can't grow stack to 0xBE1A0FF8

And this is the gdb output (relevant parts):

execute (op_array=0x8aad87c) at
/home/jani/src/php-5.2/Zend/zend_vm_execute.h:53
53              memset(EX(CVs), 0, sizeof(zval**) *
op_array->last_var);

The full backtrace is a bit too long to paste here.



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

[2008-07-09 13:28:01] thijs dot wijnmaalen at gmail dot com

Description:
------------
When accessing a method within or from another class, whereby the name

is stored as value in an array as attribute in the class.

The proper way of doing this would be to enclose the method name in 
brackets (which works as expected):

return $this->{$this->_[0]}();




Reproduce code:
---------------
<?php

class A {
	private $_ = array();
	function __toString () {
		$this->_[0] = 'a';
		return $this->$this->_[0]();
	}
	
	function a () {
		return 'call';
	}
}

echo $a = new A();

?>

Expected result:
----------------
Syntax error message

Actual result:
--------------
Empty reply from server


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


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



Thread (4 messages)

« previous php.bugs (#126434) next »