cvs: ZendEngine2 / zend_execute.c zend_execute_API.c
| From: | Marcus Boerger | Date: | Fri, 23 Jan 2004 20:58:23 +0000 |
| Subject: | cvs: ZendEngine2 / zend_execute.c zend_execute_API.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-2246@lists.php.net to get a copy of this message | ||
helly Fri Jan 23 15:58:23 2004 EDT
Modified files:
/ZendEngine2 zend_execute.c zend_execute_API.c
Log:
Disallow calling __clone/__construct/__destruct static
Send an E_STRICT when calling a non static method static
http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.584&r2=1.585&ty=u
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.584 ZendEngine2/zend_execute.c:1.585
--- ZendEngine2/zend_execute.c:1.584 Mon Jan 19 07:22:02 2004
+++ ZendEngine2/zend_execute.c Fri Jan 23 15:58:23 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.c,v 1.584 2004/01/19 12:22:02 andi Exp $ */
+/* $Id: zend_execute.c,v 1.585 2004/01/23 20:58:23 helly Exp $ */
#define ZEND_INTENSIVE_DEBUGGING 0
@@ -2517,6 +2517,17 @@
EX_T(EX(opline)->result.u.var).var.fcall_returned_reference = 0;
+ if (EX(function_state).function->common.scope) {
+ if (!EG(This) && !(EX(function_state).function->common.fn_flags &
ZEND_ACC_STATIC)) {
+ int severity;
+ if (EX(function_state).function->common.fn_flags &
(ZEND_ACC_CTOR|ZEND_ACC_DTOR|ZEND_ACC_CLONE)) {
+ severity = E_ERROR;
+ } else {
+ severity = E_STRICT;
+ }
+ zend_error(severity, "Cannot call non static method %s::%s() static",
EX(function_state).function->common.scope->name,
EX(function_state).function->common.function_name);
+ }
+ }
if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) {
ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr);
INIT_ZVAL(*(EX_T(EX(opline)->result.u.var).var.ptr));
http://cvs.php.net/diff.php/ZendEngine2/zend_execute_API.c?r1=1.251&r2=1.252&ty=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.251 ZendEngine2/zend_execute_API.c:1.252
--- ZendEngine2/zend_execute_API.c:1.251 Sun Jan 18 18:47:10 2004
+++ ZendEngine2/zend_execute_API.c Fri Jan 23 15:58:23 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute_API.c,v 1.251 2004/01/18 23:47:10 helly Exp $ */
+/* $Id: zend_execute_API.c,v 1.252 2004/01/23 20:58:23 helly Exp $ */
#include <stdio.h>
#include <signal.h>
@@ -716,6 +716,15 @@
}
} else {
EG(This) = NULL;
+ if (calling_scope && !(EX(function_state).function->common.fn_flags &
ZEND_ACC_STATIC)) {
+ int severity;
+ if (EX(function_state).function->common.fn_flags &
(ZEND_ACC_CTOR|ZEND_ACC_DTOR|ZEND_ACC_CLONE)) {
+ severity = E_ERROR;
+ } else {
+ severity = E_STRICT;
+ }
+ zend_error(E_STRICT, "Cannot call non static method %s::%s() static",
calling_scope->name, EX(function_state).function->common.function_name);
+ }
}
EX(prev_execute_data) = EG(current_execute_data);