cvs: ZendEngine2(PHP_5_3) / zend_API.c
[email protected] ("Dmitry Stogov") Wed, 14 Jan 2009 11:56:08 -0000
| Newsgroups | php.zend-engine.cvs |
|---|---|
| Message-ID | <cvsdmitry1231934168@cvsserver> |
dmitry Wed Jan 14 11:56:08 2009 UTC
Modified files: (Branch: PHP_5_3)
/ZendEngine2 zend_API.c
Log:
Fixed __call() to be invoked on private/protected method access through callbacks
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.296.2.27.2.34.2.59&r2=1.296.2.27.2.34.2.60&diff_format=u
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.296.2.27.2.34.2.59 ZendEngine2/zend_API.c:1.296.2.27.2.34.2.60
--- ZendEngine2/zend_API.c:1.296.2.27.2.34.2.59 Wed Dec 31 11:15:31 2008
+++ ZendEngine2/zend_API.c Wed Jan 14 11:56:08 2009
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_API.c,v 1.296.2.27.2.34.2.59 2008/12/31 11:15:31 sebastian Exp $ */
+/* $Id: zend_API.c,v 1.296.2.27.2.34.2.60 2009/01/14 11:56:08 dmitry Exp $ */
#include "zend.h"
#include "zend_execute.h"
@@ -2480,20 +2480,45 @@
fcc->function_handler = priv_fbc;
}
}
- } else if (fcc->object_ptr) {
- if (Z_OBJ_HT_P(fcc->object_ptr)->get_method) {
- fcc->function_handler = Z_OBJ_HT_P(fcc->object_ptr)->get_method(&fcc->object_ptr, mname, mlen TSRMLS_CC);
- retval = fcc->function_handler ? 1 : 0;
- call_via_handler = 1;
- }
- } else if (fcc->calling_scope) {
- if (fcc->calling_scope->get_static_method) {
- fcc->function_handler = fcc->calling_scope->get_static_method(fcc->calling_scope, mname, mlen TSRMLS_CC);
- } else {
- fcc->function_handler = zend_std_get_static_method(fcc->calling_scope, mname, mlen TSRMLS_CC);
+ if ((check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0 &&
+ (fcc->calling_scope &&
+ (fcc->calling_scope->__call ||
+ fcc->calling_scope->__callstatic))) {
+ if (fcc->function_handler->op_array.fn_flags & ZEND_ACC_PRIVATE) {
+ if (!zend_check_private(fcc->function_handler, fcc->object_ptr ? Z_OBJCE_P(fcc->object_ptr) : EG(scope), lmname, mlen TSRMLS_CC)) {
+ retval = 0;
+ fcc->function_handler = NULL;
+ goto get_function_via_handler;
+ }
+ } else if (fcc->function_handler->common.fn_flags & ZEND_ACC_PROTECTED) {
+ if (!zend_check_protected(fcc->function_handler->common.scope, EG(scope))) {
+ retval = 0;
+ fcc->function_handler = NULL;
+ goto get_function_via_handler;
+ }
+ }
+ }
+ } else {
+get_function_via_handler:
+ if (fcc->object_ptr) {
+ if (Z_OBJ_HT_P(fcc->object_ptr)->get_method) {
+ fcc->function_handler = Z_OBJ_HT_P(fcc->object_ptr)->get_method(&fcc->object_ptr, mname, mlen TSRMLS_CC);
+ if (fcc->function_handler) {
+ retval = 1;
+ call_via_handler = (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0;
+ }
+ }
+ } else if (fcc->calling_scope) {
+ if (fcc->calling_scope->get_static_method) {
+ fcc->function_handler = fcc->calling_scope->get_static_method(fcc->calling_scope, mname, mlen TSRMLS_CC);
+ } else {
+ fcc->function_handler = zend_std_get_static_method(fcc->calling_scope, mname, mlen TSRMLS_CC);
+ }
+ if (fcc->function_handler) {
+ retval = 1;
+ call_via_handler = (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0;
+ }
}
- retval = fcc->function_handler ? 1 : 0;
- call_via_handler = 1;
}
if (retval) {