Re: [PHP-DEV] What's the purpose of zend_result?

2023-02-19 Thread Max Kellermann
On 2023/02/19 11:56, Niels Dossche wrote: > It's also worth noting that there's a couple of places where there's > just a check for if (function()) { failure code }. i.e. there is no > check for == FAILURE, it's just "implied". Ouch. That's not only fragile, but also very obscure. (Yadda yadda,

Re: [PHP-DEV] What's the purpose of zend_result?

2023-02-19 Thread Niels Dossche
On 2/19/23 11:32, Max Kellermann wrote: > On 2023/02/19 09:45, Nikita Popov wrote: >> I expect that there are two main reasons for that: >> - There are probably some places that return a (non-negative) value or >> FAILURE. >> - There are probably some places that check for success/failure using

Re: [PHP-DEV] What's the purpose of zend_result?

2023-02-19 Thread Max Kellermann
On 2023/02/19 09:45, Nikita Popov wrote: > I expect that there are two main reasons for that: > - There are probably some places that return a (non-negative) value or > FAILURE. > - There are probably some places that check for success/failure using >= 0 > and < 0. Another POSIX-ism. > > I do

Re: [PHP-DEV] What's the purpose of zend_result?

2023-02-19 Thread Nikita Popov
On Sun, Feb 19, 2023, at 09:21, Max Kellermann wrote: > On 2023/02/19 08:56, Nikita Popov 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. I expect th

Re: [PHP-DEV] What's the purpose of zend_result?

2023-02-19 Thread Max Kellermann
On 2023/02/19 08:56, Nikita Popov 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