[EMAIL PROTECTED] wrote:
> Uhm... of course this should give you an E_ERROR, it's simply not 
> possible to call a method of an object that's only a half baken one. 
> 
> This should stay an E_ERROR.

I agree. It should raise E_ERROR for method calls.
Here is newer patch.

Any comments.

--
Yasuo Ohgaki

? incomplete_class.patch
Index: incomplete_class.c
===================================================================
RCS file: /repository/php4/ext/standard/incomplete_class.c,v
retrieving revision 1.13
diff -u -r1.13 incomplete_class.c
--- incomplete_class.c  11 Dec 2001 15:30:32 -0000      1.13
+++ incomplete_class.c  23 Jul 2002 11:21:18 -0000
@@ -30,12 +30,10 @@
                "you are trying to operate on was loaded _before_ " \
                "the session was started"
 
-#define INCOMPLETE_CLASS "__PHP_Incomplete_Class"
-#define MAGIC_MEMBER "__PHP_Incomplete_Class_Name"
 
 /* {{{ incomplete_class_message
  */
-static void incomplete_class_message(zend_property_reference *ref)
+static void incomplete_class_message(zend_property_reference *ref, int error_type)
 {
        char buf[1024];
        char *class_name;
@@ -49,7 +47,7 @@
        
        efree(class_name);
 
-       php_error(E_ERROR, "%s", buf);
+       php_error(error_type, "%s", buf);
 }
 /* }}} */
 
@@ -57,7 +55,7 @@
  */
 static void incomplete_class_call_func(INTERNAL_FUNCTION_PARAMETERS, 
zend_property_reference *property_reference)
 {
-       incomplete_class_message(property_reference);
+       incomplete_class_message(property_reference, E_ERROR);
 }
 /* }}} */
 
@@ -65,7 +63,7 @@
  */
 static int incomplete_class_set_property(zend_property_reference *property_reference, 
zval *value)
 {
-       incomplete_class_message(property_reference);
+       incomplete_class_message(property_reference, E_NOTICE);
        
        /* does not reach this point */
        return (0);
@@ -78,7 +76,7 @@
 {
        zval foo;
        
-       incomplete_class_message(property_reference);
+       incomplete_class_message(property_reference, E_NOTICE);
 
        /* does not reach this point */
        memset(&foo, 0, sizeof(zval)); /* shut warnings up */
Index: php_incomplete_class.h
===================================================================
RCS file: /repository/php4/ext/standard/php_incomplete_class.h,v
retrieving revision 1.8
diff -u -r1.8 php_incomplete_class.h
--- php_incomplete_class.h      11 Dec 2001 15:30:35 -0000      1.8
+++ php_incomplete_class.h      23 Jul 2002 11:21:18 -0000
@@ -44,12 +44,13 @@
        size_t name_len;                                                               
                                         \
        zend_bool free_class_name = 0                                                  
                         \
 
-
+#define INCOMPLETE_CLASS "__PHP_Incomplete_Class"
+#define MAGIC_MEMBER "__PHP_Incomplete_Class_Name"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
-
+       
 zend_class_entry *php_create_incomplete_class(TSRMLS_D);
 
 char *php_lookup_class_name(zval *object, size_t *nlen, zend_bool del);
Index: type.c
===================================================================
RCS file: /repository/php4/ext/standard/type.c,v
retrieving revision 1.18
diff -u -r1.18 type.c
--- type.c      8 Jul 2002 18:29:54 -0000       1.18
+++ type.c      23 Jul 2002 11:21:18 -0000
@@ -19,6 +19,7 @@
 /* $Id: type.c,v 1.18 2002/07/08 18:29:54 andi Exp $ */
 
 #include "php.h"
+#include "php_incomplete_class.h"
 
 /* {{{ proto string gettype(mixed var)
    Returns the type of the variable */
@@ -200,6 +201,13 @@
        }
 
        if (Z_TYPE_PP(arg) == type) {
+               if (type == IS_OBJECT) {
+                       zend_class_entry *ce;
+                       ce = Z_OBJCE_PP(arg);
+                       if (!strcmp(ce->name, INCOMPLETE_CLASS)) {
+                               RETURN_FALSE;
+                       }
+               }
                RETURN_TRUE;
        } else {
                RETURN_FALSE;

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to