summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2003-07-16 09:13:47 +0000
committerZeev Suraski <zeev@php.net>2003-07-16 09:13:47 +0000
commite10dbc607c49def182dc7631cf87005271bc4be7 (patch)
tree13d0ff732fb6307e3da1f9eae577d2ef73f0948c
parent3a898f6d4ec96376a865ffa53b8cc319ef1535d9 (diff)
downloadphp-git-e10dbc607c49def182dc7631cf87005271bc4be7.tar.gz
Fix bug in the verification of interface-function implementation
-rw-r--r--Zend/zend_compile.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index dfda708646..595a27c4c5 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1676,6 +1676,7 @@ static zend_bool zend_do_perform_implementation_check(zend_function *fe)
op = fe->op_array.opcodes;
proto_op = fe->common.prototype->op_array.opcodes;
+ /* Make sure that the implementation has all of the arguments of the interface */
while (proto_op->opcode != ZEND_RAISE_ABSTRACT_ERROR) {
if (proto_op->opcode != op->opcode) {
return 0;
@@ -1690,7 +1691,21 @@ static zend_bool zend_do_perform_implementation_check(zend_function *fe)
proto_op++;
op++;
}
- return 1;
+
+ /* Make sure that the implementation doesn't receive more arguments than the interface */
+ while (1) {
+ switch (op->opcode) {
+ case ZEND_FETCH_CLASS:
+ case ZEND_FETCH_W:
+ op++;
+ break;
+ case ZEND_RECV:
+ case ZEND_RECV_INIT:
+ return 0;
+ default:
+ return 1;
+ }
+ }
}