]> granicus.if.org Git - php/commitdiff
is_object() returns FALSE if object is a "incomplete object".
authorYasuo Ohgaki <yohgaki@php.net>
Wed, 24 Jul 2002 09:55:11 +0000 (09:55 +0000)
committerYasuo Ohgaki <yohgaki@php.net>
Wed, 24 Jul 2002 09:55:11 +0000 (09:55 +0000)
Raise E_NOTICE, instead of E_ERROR, for setting/getting properties
to/from a "incomplete object".

ext/standard/incomplete_class.c
ext/standard/php_incomplete_class.h
ext/standard/type.c

index ee49154c175e10c0e4f6fb97759f8847413679f3..ef0e2116c2036d21c5f53e6622cf61f4680d88cd 100644 (file)
                "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 @@ static void incomplete_class_message(zend_property_reference *ref)
        
        efree(class_name);
 
-       php_error(E_ERROR, "%s", buf);
+       php_error(error_type, "%s", buf);
 }
 /* }}} */
 
@@ -57,7 +55,7 @@ static void incomplete_class_message(zend_property_reference *ref)
  */
 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 void incomplete_class_call_func(INTERNAL_FUNCTION_PARAMETERS, zend_proper
  */
 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 @@ static zval incomplete_class_get_property(zend_property_reference *property_refe
 {
        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 90ab2a17c9b0b96a52943081069a4dca1a0847b5..390ca03bfb7f7b0932562b0693e0c312133f842b 100644 (file)
        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 b6a61c3173b84eba1901440c96eb1bdf97731b01..f42c46ade98372acd26ffe97f9cd8e0631990747 100644 (file)
@@ -19,6 +19,7 @@
 /* $Id$ */
 
 #include "php.h"
+#include "php_incomplete_class.h"
 
 /* {{{ proto string gettype(mixed var)
    Returns the type of the variable */
@@ -200,6 +201,13 @@ static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
        }
 
        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;