php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | |
Patch remove-inheritance-check-at-call.patch for Scripting Engine problem Bug #51886Patch version 2010-06-08 04:54 UTC Return to Bug #51886 | Download this patchThis patch is obsolete Obsoleted by patches: Patch Revisions:Developer: boldin.pavel@gmail.comdiff -NurpP ./php-5.3.2.orig/Zend//zend_API.c ./php-5.3.2.new/Zend//zend_API.c --- ./php-5.3.2.orig/Zend//zend_API.c 2010-01-25 17:02:09.000000000 +0300 +++ ./php-5.3.2.new/Zend//zend_API.c 2010-06-08 08:46:06.000000000 +0400 @@ -2387,8 +2387,7 @@ static int zend_is_callable_check_class( fcc->calling_scope = *pce; if (scope && !fcc->object_ptr && EG(This) && - instanceof_function(Z_OBJCE_P(EG(This)), scope TSRMLS_CC) && - instanceof_function(scope, fcc->calling_scope TSRMLS_CC)) { + instanceof_function(Z_OBJCE_P(EG(This)), scope TSRMLS_CC)) { fcc->object_ptr = EG(This); fcc->called_scope = Z_OBJCE_P(fcc->object_ptr); } else { diff -NurpP ./php-5.3.2.orig/tests/lang/bug51886.phpt ./php-5.3.2.new/tests/lang/bug51886.phpt --- ./php-5.3.2.orig/tests/lang/bug51886.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ./php-5.3.2.new/tests/lang/bug51886.phpt 2010-06-08 04:51:00.000000000 +0400 @@ -0,0 +1,38 @@ +--TEST-- +Bug #51886 (call_user_func does not set $this for PHP-4 compability) +--FILE-- +<?php +error_reporting(error_reporting() & ~E_STRICT); +class t1 +{ + public function __call($method,$args) { + //call_user_func('t2::some_method',$args);//for PHP 5.3 + call_user_func(array('t2','some_method'),$args); + t2::some_method(); + } + + public function existing_method() { + //call_user_func('t2::some_method');//for PHP 5.3 + call_user_func(array('t2','some_method')); + t2::some_method(); + } +} + +class t2 +{ + public function some_method() { + print isset($this)?'yes':'no'; + print PHP_EOL; + } +} + +$t1 = new t1; + +$t1->existing_method(); +$t1->non_existing_method();//use overloading +?> +--EXPECT-- +yes +yes +yes +yes |
Copyright © 2001-2024 The PHP Group All rights reserved. |
Last updated: Mon May 06 07:01:32 2024 UTC |