cvs: php4 /ext/standard incomplete_class.c php_incomplete_class.h type.c

From: Date: Wed, 24 Jul 2002 09:55:11 +0000
Subject: cvs: php4 /ext/standard incomplete_class.c php_incomplete_class.h type.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-12958@lists.php.net to get a copy of this message
yohgaki Wed Jul 24 05:55:11 2002 EDT Modified files: /php4/ext/standard incomplete_class.c php_incomplete_class.h type.c Log: is_object() returns FALSE if object is a "incomplete object". Raise E_NOTICE, instead of E_ERROR, for setting/getting properties to/from a "incomplete object". Index: php4/ext/standard/incomplete_class.c diff -u php4/ext/standard/incomplete_class.c:1.13 php4/ext/standard/incomplete_class.c:1.14 --- php4/ext/standard/incomplete_class.c:1.13 Tue Dec 11 10:30:32 2001 +++ php4/ext/standard/incomplete_class.c Wed Jul 24 05:55:11 2002 @@ -17,7 +17,7 @@ */ -/* $Id: incomplete_class.c,v 1.13 2001/12/11 15:30:32 sebastian Exp $ */ +/* $Id: incomplete_class.c,v 1.14 2002/07/24 09:55:11 yohgaki Exp $ */ #include "php.h" #include "basic_functions.h" @@ -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: php4/ext/standard/php_incomplete_class.h diff -u php4/ext/standard/php_incomplete_class.h:1.8 php4/ext/standard/php_incomplete_class.h:1.9 --- php4/ext/standard/php_incomplete_class.h:1.8 Tue Dec 11 10:30:35 2001 +++ php4/ext/standard/php_incomplete_class.h Wed Jul 24 05:55:11 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_incomplete_class.h,v 1.8 2001/12/11 15:30:35 sebastian Exp $ */ +/* $Id: php_incomplete_class.h,v 1.9 2002/07/24 09:55:11 yohgaki Exp $ */ #ifndef PHP_INCOMPLETE_CLASS_H #define PHP_INCOMPLETE_CLASS_H @@ -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: php4/ext/standard/type.c diff -u php4/ext/standard/type.c:1.18 php4/ext/standard/type.c:1.19 --- php4/ext/standard/type.c:1.18 Mon Jul 8 14:29:54 2002 +++ php4/ext/standard/type.c Wed Jul 24 05:55:11 2002 @@ -16,9 +16,10 @@ +----------------------------------------------------------------------+ */ -/* $Id: type.c,v 1.18 2002/07/08 18:29:54 andi Exp $ */ +/* $Id: type.c,v 1.19 2002/07/24 09:55:11 yohgaki 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;

« previous php.cvs (#12958) next »