[PHP4BETA] Re: First contact...

From: Date: Fri, 09 Apr 1999 08:41:42 +0000
Subject: [PHP4BETA] Re: First contact...
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-35@lists.php.net to get a copy of this message
Zeev Suraski schrieb: > I think that if we can get PHPLIB > working with less than a thousand lines of code changed in > Zend, we're in good shape :) Quoting Kosh from Babylon 5: "And so it begins..." I was at Oracle yesterday (Oracle WebDB contains a few nice ideas which I want to try out on PHPLIB...), but Boris neglected working on his thesis a little... :-) He had some interesting experiences when accessing $GLOBALS[], which is essential for serialize() to work. I have forwarded his comments in a separate message. Actually, I would like to see a better serialize() in PHP4 and get rid of our own serialize() in PHPLIB - would be a great speed increase I presume. For this to be possible, two things are necessary: - serialize() must keep the object-class relationship over a serialize()/unserialize() pair. That is, if I unserialize() an object, I must be able to invoke methods of that object. - I must be able to selectively NOT serialize certain slots in certain objects. I must be able to do this, because in some objects I have a database connection identifier, which must not be retained over a serialize()/unserialize() pair - the database connection is not being retained and so the connection identifier is invalid after the unserialize() and must not be serialized() in the first place. Our own serialize() function uses an array persistent_slots[] within an object to indicate which slots of the object are to be saved. The default is not to save any slots, which is the wrong default (if there is no persistent_slots[] array, it is usually save to assume all slots should be retained), but works if you know about that. Soft solution: It would be okay for a serizalize() builtin function to have an optional array parameter indicating the names of the object slots that are to be serialized(). Hard solution: Or, if you really want to make it a language feature, use a keyword as in class A { var $slot_that_will_be_serialized; volatile var $slot_that_will_be_lost; function f() { print "It works\n"; } } $a = new A; $a->slot_that_will_be_serialized = 1; $a->slot_that_will_be_lost = 1; $str = serialize($a); unset $a; // later, in a different process unserialize($str); $a->f(); // does it? print $a->slot_that_will_be_serialized; // is 1. print $a->slot_that_will_be_lost; // is 0. Comments? Kristian -- Kristian Köhntopp, NetUSE Kommunikationstechnologie GmbH Siemenswall, D-24107 Kiel, Germany, +49 431 386 436 00 Using PHP3? See our web development library at http://phplib.shonline.de/ (GPL) -- PHP 4 Beta

« previous php.version4 (#35) next »