Re: What's the purpose of zend_result?
| From: | Max Kellermann | Date: | Sun, 19 Feb 2023 08:21:21 +0000 |
| Subject: | Re: What's the purpose of zend_result? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119574@lists.php.net to get a copy of this message | ||
On 2023/02/19 08:56, Nikita Popov <nikita.ppv@gmail.com> wrote:
> If you have a function like zend_stream_open_function(), SUCCESS and FAILURE are directly
> meaningful values.
Agree, but that doesn't explain why FAILURE needs to be negative.
> The current guideline for use of bool and zend_result in php-src is that bool is an appropriate
> return value for "is" or "has" style functions, which return a yes/no answer.
> zend_result is an appropriate return value for functions that perform some operation that may
> succeed or fail.
What does the return value of these functions mean?
- zend_make_printable_zval()
- zend_make_callable()
- zend_parse_arg_bool()
- zend_fiber_init_context()
- zend_observer_remove_begin_handler()
- php_execute_script()1
If I understand the guideline correctly, then those examples (and
countless others) are defective and should be fixed, correct?
Max