Skip to content

Commit

Permalink
Fixed bug #44414 (Incomplete reporting about abstract methods)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Mar 12, 2008
1 parent c33db5c commit 0f2247a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -126,6 +126,7 @@ PHP NEWS
- Fixed possible crash in ext/soap because of uninitialized value. (Zdash Urf)
- Fixed PECL bug #12431 (OCI8 ping functionality is broken). (Oracle Corp.)

- Fixed bug #44414 (Incomplete reporting about abstract methods). (Dmitry)
- Fixed bug #44394 (Last two bytes missing from output). (Felipe)
- Fixed bug #44336 (Improve pcre UTF-8 string matching performance).
(frode at coretrek dot com, Nuno)
Expand Down
15 changes: 15 additions & 0 deletions Zend/tests/bug44414.phpt
@@ -0,0 +1,15 @@
--TEST--
Bug #44414 (incomplete reporting about abstract methods)
--FILE--
<?php
abstract class A {
abstract function foo();
}
interface B {
function bar();
}
class C extends A implements B {
}
?>
--EXPECTF--
Fatal error: Class C contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (A::foo, B::bar) in %sbug44414.php on line 9
10 changes: 7 additions & 3 deletions Zend/zend_compile.c
Expand Up @@ -2588,7 +2588,8 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent

if (ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS && ce->type == ZEND_INTERNAL_CLASS) {
ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
} else {
} else if (!(ce->ce_flags & ZEND_ACC_IMPLEMENT_INTERFACES)) {
/* The verification will be done in runtime by ZEND_VERIFY_ABSTRACT_CLASS */
zend_verify_abstract_class(ce TSRMLS_CC);
}
}
Expand Down Expand Up @@ -2700,7 +2701,7 @@ ZEND_API zend_class_entry *do_bind_class(zend_op *opline, HashTable *class_table
}
return NULL;
} else {
if (!(ce->ce_flags & ZEND_ACC_INTERFACE)) {
if (!(ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLEMENT_INTERFACES))) {
zend_verify_abstract_class(ce TSRMLS_CC);
}
return ce;
Expand Down Expand Up @@ -3246,10 +3247,13 @@ void zend_do_end_class_declaration(znode *class_token, znode *parent_token TSRML
}
}
/* Inherit interfaces; reset number to zero, we need it for above check and
* will restore it during actual implementation. */
* will restore it during actual implementation.
* The ZEND_ACC_IMPLEMENT_INTERFACES flag disables double call to
* zend_verify_abstract_class() */
if (ce->num_interfaces > 0) {
ce->interfaces = NULL;
ce->num_interfaces = 0;
ce->ce_flags |= ZEND_ACC_IMPLEMENT_INTERFACES;
}
CG(active_class_entry) = NULL;
}
Expand Down
4 changes: 4 additions & 0 deletions Zend/zend_compile.h
Expand Up @@ -143,6 +143,10 @@ typedef struct _zend_try_catch_element {
/* deprecation flag */
#define ZEND_ACC_DEPRECATED 0x40000

/* class implement interface(s) flag */
#define ZEND_ACC_IMPLEMENT_INTERFACES 0x80000


char *zend_visibility_string(zend_uint fn_flags);


Expand Down

0 comments on commit 0f2247a

Please sign in to comment.