For Programmers: Free Programming Magazines  


Home > Archive > PHP Zend Engine > April 2004 > cvs: ZendEngine2 / zend_compile.c









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cvs: ZendEngine2 / zend_compile.c
Zeev Suraski

2004-04-21, 5:34 am

zeev Wed Apr 21 04:44:37 2004 EDT

Modified files:
/ZendEngine2 zend_compile.c
Log:
Restore fatal error in case a method that's supposed to implement an
interface/abstract method, breaks its prototype


http://cvs.php.net/diff.php/ZendEng...3&r2=1.564&ty=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.563 ZendEngine2/zend_compile.c:1.564
--- ZendEngine2/zend_compile.c:1.563 Fri Mar 26 15:05:19 2004
+++ ZendEngine2/zend_compile.c Wed Apr 21 04:44:37 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/

-/* $Id: zend_compile.c,v 1.563 2004/03/26 20:05:19 helly Exp $ */
+/* $Id: zend_compile.c,v 1.564 2004/04/21 08:44:37 zeev Exp $ */

#include "zend_language_parser.h"
#include "zend.h"
@@ -1711,16 +1711,20 @@
}


-static zend_bool zend_do_perform_implementation_check(zen
d_function *fe)
+static zend_bool zend_do_perform_implementation_check(zen
d_function *fe, zend_function *proto)
{
zend_uint i;
- zend_function *proto = fe->common.prototype;

/* If it's a user function then arg_info == NULL means we don't have any parameters but we still need to do the arg number checks. We are only willing to ignore this for internal functions because extensions don't always define arg_info. */
if (!proto || (!proto->common.arg_info && proto->common.type != ZEND_USER_FUNCTION)) {
return 1;
}

+ /* No implementation checks for constructors */
+ if (fe->common.fn_flags & ZEND_ACC_CTOR) {
+ return 1;
+ }
+
/* check number of arguments */
if (proto->common.required_num_args != fe->common.required_num_args
|| proto->common.num_args > fe->common.num_args) {
@@ -1818,15 +1822,21 @@
}
}

- child->common.prototype = parent;
if (parent_flags & ZEND_ACC_ABSTRACT) {
child->common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT;
+ child->common.prototype = parent;
+ } else {
+ child->common.prototype = parent->common.prototype;
}

- /* Check E_STRICT before the check so that we save some time */
- if(EG(error_reporting) & E_STRICT) {
- if (!(child->common.fn_flags & ZEND_ACC_CTOR) && !zend_do_perform_implementation_check(ch
ild)) {
- zend_error(E_STRICT, "Declaration of %s::%s() must be compatible with that of %s::%s()", ZEND_FN_SCOPE_NAME(child), child->common.function_name, ZEND_FN_SCOPE_NAME(child->common.prototype), child->common.prototype->common.function_name);
+
+ if (child->common.prototype) {
+ if (!zend_do_perform_implementation_check(c
hild, child->common.prototype)) {
+ zend_error(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with that of %s::%s()", ZEND_FN_SCOPE_NAME(child), child->common.function_name, ZEND_FN_SCOPE_NAME(child->common.prototype), child->common.prototype->common.function_name);
+ }
+ } else if (EG(error_reporting) & E_STRICT) { /* Check E_STRICT before the check so that we save some time */
+ if (!zend_do_perform_implementation_check(c
hild, parent)) {
+ zend_error(E_STRICT, "Declaration of %s::%s() should be compatible with that of %s::%s()", ZEND_FN_SCOPE_NAME(child), child->common.function_name, ZEND_FN_SCOPE_NAME(parent), parent->common.function_name);
}
}

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com