Please confirm behaviour of ZEND_ACC_STATIC
| From: | l0t3k | Date: | Fri, 02 Jul 2004 13:51:00 +0000 |
| Subject: | Please confirm behaviour of ZEND_ACC_STATIC | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-10872@lists.php.net to get a copy of this message | ||
in my extension, i have a class which has methods which work slightly
differently depending on whether or not they are called statically.
as an example :
$original = new UnicodeString("HELLO WORLD","utf8");
$lower = UnicodeString::toLowerCase($original); /* returns a new copy
*/
$lower1 = $original->toLowerCase(); /* original is lowercased. return a
reference */
the latter is for efficiency. imagine chains like
print_r($original->reverse()->toTitleCase()->split(" ")); /* no
intermediaries created work on $original*/
while the former allows for transformations without affecting the original
string.
since the method can behave statically, it is marked as ZEND_ACC_STATIC.
however it appears that once marked as such,
getThis() always reports NULL. i've confirmed that marking it as non static
cause the object to be properly passed.
is this a WAD. if so, is it possible (at least for internal functions) for a
method to be called statically as well as in an object context ?
l0t3k