php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58999 Problems with registering classes containing __get()
Submitted: 2009-12-18 17:19 UTC Modified: 2010-02-22 13:04 UTC
From: an at 25g dot net Assigned:
Status: Closed Package: spidermonkey (PECL)
PHP Version: 5_3.1RC2 OS: Gentoo Linux x86_64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: an at 25g dot net
New email:
PHP Version: OS:

 

 [2009-12-18 17:19 UTC] an at 25g dot net
Description:
------------
There seems to be a problem with registering classes, which 
use the magic method __get(). If a method with this name is 
defined for a class, no method calls (to any method of this 
class)  are possible within JS.

PECL-Spidermonkey was build against spidermonkey-1.7.0 with 
threadsafe USE-Flag (which basically means make is called 
with JS_THREADSAFE=1)

PHP 5.3.1 (the stable version was used, but it was not 
possible to select it in the above selectbox) was compiled 
with the following configure line:
./configure'  '--prefix=/usr/lib64/php5' '--host=x86_64-pc-
linux-gnu' '--mandir=/usr/lib64/php5/man' '--
infodir=/usr/lib64/php5/info' '--sysconfdir=/etc' '--cache-
file=./config.cache' '--with-libdir=lib64' '--with-pcre-
regex=/usr' '--enable-maintainer-zts' '--enable-cli' '--
disable-cgi' '--with-config-file-path=/etc/php/cli-php5' '--
with-config-file-scan-dir=/etc/php/cli-php5/ext-active' '--
without-pear' '--disable-bcmath' '--with-bz2' '--disable-
calendar' '--without-curl' '--without-curlwrappers' '--
enable-exif' '--enable-ftp' '--with-gettext' '--with-gmp' '-
-disable-hash' '--without-kerberos' '--enable-mbstring' '--
with-mcrypt' '--without-mhash' '--without-mssql' '--with-
openssl' '--with-openssl-dir=/usr' '--enable-pcntl' '--with-
pgsql' '--with-pspell' '--without-recode' '--disable-shmop' 
'--without-snmp' '--enable-soap' '--enable-sockets' '--
without-sybase-ct' '--enable-sysvmsg' '--enable-sysvsem' '--
enable-sysvshm' '--without-tidy' '--disable-wddx' '--
disable-xmlreader' '--disable-xmlwriter' '--with-xmlrpc' '--
with-xsl' '--enable-zip' '--with-zlib' '--disable-debug' '--
without-enchant' '--disable-intl' '--disable-phar' '--
enable-dba' '--without-cdb' '--with-db4' '--disable-
flatfile' '--with-gdbm' '--disable-inifile' '--without-qdbm' 
'--with-freetype-dir=/usr' '--with-t1lib=/usr' '--disable-
gd-jis-conv' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '-
-without-xpm-dir' '--with-gd' '--with-imap' '--with-imap-
ssl' '--with-mysql=/usr' '--with-mysql-
sock=/var/run/mysqld/mysqld.sock' '--with-
mysqli=/usr/bin/mysql_config' '--without-pdo-dblib' '--with-
pdo-mysql=/usr' '--without-pdo-odbc' '--with-pdo-pgsql' '--
with-pdo-sqlite=/usr' '--with-readline' '--without-libedit' 
'--without-mm' '--with-sqlite=/usr' '--enable-sqlite-utf8'

If you need any further informations, give me a hint what 
you need, and I will try to provide it.



Reproduce code:
---------------
$ctx = new JSContext();

class Test {
	public function __get($key){
		// Problem exists even if not used, it is enough if it is defined! 
		// If you remove this method definition, everything works fine.
	}
	
    public function doSomething(){
    	echo "Foo!";
    }
}

$ctx->registerClass("Test");
$ctx->evaluateScript("var m = new Test();m.doSomething();");

Expected result:
----------------
Should print "Foo!"

Actual result:
--------------
Instead the following Exception is thrown:

PHP Fatal error:  Uncaught exception 'Exception' with message 
'TypeError: m.doSomething is not a function' in ..... 

If you delete the method definition for __get(), everything 
works fine, and the expected result is given.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-22 13:04 UTC] c dot robin at smartphp dot org
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 [2013-05-18 18:45 UTC] lukman135cc at Gmail dot com
error8999
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 00:01:28 2024 UTC