[EMAIL PROTECTED] wrote:
> On Tue, 23 Jul 2002, Yasuo Ohgaki wrote:
> 
> 
>>It seems accessing incoplete object became fatal error.
>>
>>----
>>Fatal error: The script tried to execute a method or access a property 
>>of an incomplete object. Please ensure that the class definition auth of 
>>the object you are trying to operate on was loaded _before_ the session 
>>was started in
>>----
>>
>>This breaks my session data manager and makes the manager unusable.
>>I'm listing incomplete object properties for administrative purpose.
>>
>>Any comments?
> 
> 
> 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.

You must be too tired.

Accessing object properties in session database, _NOT_ method.

It should be able to access properties. Otherwise, users
aren't able to write session data admin apps with PHP.

It also possible users may have application intentionally
using incomplete object because complete object is not needed
for the page. Thus, current code may break these optimized scripts.

Therefore, I think it may be ok with E_NOTICE instead of E_WARNING.

Anyway, here is a patch to make is_object() return false for
incomplete objects.

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 10:38:41 -0000
@@ -30,8 +30,6 @@
                "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
  */
@@ -49,7 +47,7 @@
        
        efree(class_name);
 
-       php_error(E_ERROR, "%s", buf);
+       php_error(E_WARNING, "%s", buf);
 }
 /* }}} */
 
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 10:38:41 -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 10:38:42 -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