Re: [PHP-DEV] Planning an RFC to allow calls to global functions in constant expressions

2020-02-01 Thread Stanislav Malyshev
Hi! > The constant expressions will be evaluated at the same time php currently > evaluates constant > expressions. But you essentially propose running arbitrary code at that time, which is much bigger deal than evaluating simple constant expressions. While simple functions like strlen() would

Re: [PHP-DEV] Planning an RFC to allow calls to global functions in constant expressions

2020-02-01 Thread tyson andre
> What happens if a function like strlen() is applied to a non-string > argument? Conversion to string is certainly runtime-dependent even for > primitive types like floats. Good point. I thought that string casts were already allowed, but was mistaken. It's possible to cast to string through

Re: [PHP-DEV] Planning an RFC to allow calls to global functions in constant expressions

2020-02-01 Thread Stanislav Malyshev
Hi! > For example, allow `\count()`, `\strlen()`, `\array_merge()`, and > `\in_array()`, > but don't allow functions such as > `\strtolower()` (different in Turkish locale), What happens if a function like strlen() is applied to a non-string argument? Conversion to string is certainly

[PHP-DEV] Planning an RFC to allow calls to global functions in constant expressions

2020-02-01 Thread tyson andre
Hi internals, I have a working implementation for calling global functions in constant expressions at https://github.com/php/php-src/pull/5139 (see PR description for more details, see tests for how edge cases get resolved) If there was interest, and no implementation or process blockers I

RE: [PHP-DEV] Operator overloading for userspace objects

2020-02-01 Thread jan.h.boehmer
On Sat, Feb 1, 2020 10:22 AM wrote: > Looks much better! If you submit a pull request, I can leave some more > detailed comments. Okay, I will submit a pull request with my changes. > If you would like to start an RFC on this topic, please sign up for a wiki > account

Re: [PHP-DEV] Operator overloading for userspace objects

2020-02-01 Thread Nikita Popov
On Thu, Jan 30, 2020 at 10:22 PM wrote: > > Unfortunately, this implementation goes in the wrong direction: PHP > already has full internal support for operator overloading through the > do_operation object handler. Operator overloading should be exposed to > userland through that handler as