]> granicus.if.org Git - php/commitdiff
- Change prototype isA check not to check the constructor.
authorAndi Gutmans <andi@php.net>
Sun, 29 Feb 2004 18:25:50 +0000 (18:25 +0000)
committerAndi Gutmans <andi@php.net>
Sun, 29 Feb 2004 18:25:50 +0000 (18:25 +0000)
- Only give an E_STRICT for non-isA compliant code as opposed to
  E_COMPILE_ERROR.

Zend/zend_compile.c

index a56709aa34c0c8cd8aaddf3bcc542e657f663e6a..5caf910e4abb54f4af0cf6207691dcd41865adba 100644 (file)
@@ -1713,7 +1713,8 @@ static zend_bool zend_do_perform_implementation_check(zend_function *fe)
        zend_uint i;
        zend_function *proto = fe->common.prototype;
 
-       if (!proto || !proto->common.arg_info) {
+       /* 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;
        }
 
@@ -1814,22 +1815,16 @@ static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_f
                }
        }
 
-       if (EG(ze1_compatibility_mode)) {
-               if (parent_flags & ZEND_ACC_ABSTRACT) {
-                       child->common.prototype = parent;
-                       child->common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT;
-               } else {
-                       child->common.prototype = parent->common.prototype;
-               }
-       } else {
-               child->common.prototype = parent;
-               if (parent_flags & ZEND_ACC_ABSTRACT) {
-                       child->common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT;
-               }
+       child->common.prototype = parent;
+       if (parent_flags & ZEND_ACC_ABSTRACT) {
+               child->common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT;
        }
 
-       if (!zend_do_perform_implementation_check(child)) {
-               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);
+       /* 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(child)) {
+                       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);
+               }
        }
 
        return 0;
@@ -3406,7 +3401,7 @@ void zend_do_foreach_end(znode *foreach_token, znode *open_brackets_token TSRMLS
 
        do_end_loop(foreach_token->u.opline_num TSRMLS_CC);
 
-       zend_stack_top(&CG(foreach_copy_stack), &container_ptr);
+       zend_stack_top(&CG(foreach_copy_stack), (void **) &container_ptr);
        generate_free_foreach_copy(container_ptr TSRMLS_CC);
        zend_stack_del_top(&CG(foreach_copy_stack));