cvs: ZendEngine2 / ZEND_CHANGES

From: Date: Tue, 30 Dec 2003 13:14:14 +0000
Subject: cvs: ZendEngine2 / ZEND_CHANGES
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-2166@lists.php.net to get a copy of this message
helly Tue Dec 30 08:14:14 2003 EDT Modified files: /ZendEngine2 ZEND_CHANGES Log: Update Index: ZendEngine2/ZEND_CHANGES diff -u ZendEngine2/ZEND_CHANGES:1.69 ZendEngine2/ZEND_CHANGES:1.70 --- ZendEngine2/ZEND_CHANGES:1.69 Thu Nov 13 03:23:49 2003 +++ ZendEngine2/ZEND_CHANGES Tue Dec 30 08:14:14 2003 @@ -19,6 +19,35 @@ the box or after a very small amount of modifications would be high. + * $this + + Unlike in Zend Engine 1 the pseudo variable $this cannot be + exchanged in Zend Engine 2. You can of course modify or work with + an object by using $this but you cannot replace $this with another + object to change the original object. + + Example: + + <?php + class Foo { + function replace($other) + { + $this = $other; + } + } + + $object = new Foo; + $object->prop = 'Hello'; + + $other = new Foo; + $other->prop = 'Bye'; + + $object->replace($other); + + print $object->prop; // still shows 'Hello' + + ?> + * Private and Protected Members. The Zend Engine 2.0 introduces private and protected member @@ -717,7 +746,8 @@ * Iteration Objects may be iterated in an overloaded way when used with - foreach. The default behavior is to iterate over all properties. + foreach. The default behavior is to iterate over all properties + with respect to property visibility. Example: @@ -734,9 +764,6 @@ } ?> - TBD: Respect visibility: Show protected only when inside class - method and only otherwise public properties only. - Each class whose instances can be iterated with foreach should implement the empty interface 'Traversable'. Hence any object that says it implements 'Traversable' can be used with foreach. @@ -832,7 +859,12 @@ * __toString() The magic method __toString() allows to overload the object to - string conversion. + string conversion. This conversion is only done automatically for + printing functions (echo, *printf) but not for other functions + that expect strings. Also the function __toStrign is not used in + places where objects are not allowed but strings are like array + indices. Note that specialized objects maybe converted to a string + in any place but without calling __tostring(). Example: @@ -847,6 +879,10 @@ $str = (string) $obj; // call __toString() echo $obj; // call __toString() + + $ar = array(); + $ar[(string)$obj]; // this works + $ar[$obj]; // this is not allowed ?> * Reflection API

« previous php.zend-engine.cvs (#2166) next »