Hi.

As you may or may not know, the "zend_bool" arg_info->pass_by_reference, may take three values:

785 #define ZEND_SEND_BY_VAL     0
786 #define ZEND_SEND_BY_REF     1
787 #define ZEND_SEND_PREFER_REF 2

The last one is used one the function can either take a value or reference; see e.g. array_multisort.

ReflectionParameter has only only method, with an actual boolean return to test this, isPassedByReference(). This returns true for ZEND_SEND_BY_REF or ZEND_SEND_PREFER_REF, so there's no way to distinguish between the two.

To solve this, I added to trunk ReflectionParameter::canBePassedByValue(), which tests for ZEND_SEND_BY_VAL or ZEND_SEND_PREFER_REF.

Concerns have been raised over the naming of the method and over whether having three methods for three values would be more appropriate (with a minor BC break, changing the behavior of isPassedByReference() to return true only with ZEND_SEND_BY_REF).

Any comments on this issue are appreciated.

Thanks

--
Gustavo Lopes

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to