Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Rowan Tommins
On 30/10/2023 12:24, Alessandro Rosa wrote: I have posted a new RFC at this link https://wiki.php.net/rfc/empty_function where I suggested some improvements to the standard built-in empty() function and provided a number of examples. Hi, and welcome! First, regarding the clarity of the pro

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Kamil Tekiela
I would be voting against any function that checks for "empty". The `empty()` construct we have now should almost never be used in any reasonable code. It should be avoided at all cost. For this reason, I see no need to introduce a new variant of the same thing. I also don't believe there is any ne

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Hamza Ahmad
Hi there, it's a legacy function, and I don't think we can afford or we should consider this bc break. Though I don't use this function myself and also prefer other methods of input validation, still there are a lot of people that use it. Renaming this to is_empty will bring a bc break. However, th

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Alessandro Rosa
Thanks everybody for joining this discussion. I appreciated a lot the points you raised, as they are helping me to update and improve my rfc, whose meaning, as I hope, would look clearer than the earlier version. Improvements must be achieved, whatever they would cost. Ambiguities shall be resolv

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread tag Knife
> > This is exactly where the problem lies. Is a string with just whitespace > empty? Why would an ArrayObject with count 0 not be considered to be empty > while an array with count 0 is? "empty" is subjective and therefore not a > reliable function to use. Especially in legacy code I find that peo

Re: [PHP-DEV] Discussion - Anti-null coercion

2023-10-30 Thread Larry Garfield
On Mon, Oct 30, 2023, at 11:17 AM, Ilija Tovilo wrote: > Hi Robert > > On Sun, Oct 29, 2023 at 7:31 PM Robert Landers > wrote: >> >> Hello Internals, >> >> We currently have a null coercion operator: ??, but we lack an >> anti-null coercion operator. >> ... >> fn() => >> ($_SERVER['HTTP_X_MY_HE

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Alessandro Rosa
Thanks everybody for joining this discussion. I appreciated a lot the points you raised, as they are helping me to update and improve my rfc, whose meaning, as I hope, would look clearer than the earlier version. Alessandro Il giorno lun 30 ott 2023 alle ore 16:36 Lynn ha scritto: > On Mon, Oc

Re: [PHP-DEV] Basic Type Alias

2023-10-30 Thread Larry Garfield
On Sun, Oct 29, 2023, at 9:52 PM, Jorg Sowa wrote: > I really like the idea and I would love to see it in PHP. I'm wondering > however, what would be the scope of the feature and how complex would be > designed type system. Examples I saw in this thread could be easily > replaced with union and int

Re: [PHP-DEV] Issue with php.net

2023-10-30 Thread Saki Takamachi
Hi, The issue has opened here. https://github.com/php/web-php/issues/820 Regards. Saki -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Lynn
On Mon, Oct 30, 2023 at 4:21 PM tag Knife wrote: > > > > However, according to my example, the variable is defined and has its > > value as 0 or false, and empty() returns true anyway. I confess that > > I've had some problems like this, and we chose not to use empty(), as > > sometimes 0 or fals

[PHP-DEV] Issue with php.net

2023-10-30 Thread Thomas Nunninger
Hi, sorry, I don't know where to send this. But When visiting https://www.php.net/ I get a certificate error: The provided certificate is for www.caruso.ovh. When visiting http://www.php.net (http only), I get redirected to http://www.caruso.ovh/ Regards Thomas -- PHP Internals - PHP Runt

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread tag Knife
> > However, according to my example, the variable is defined and has its > value as 0 or false, and empty() returns true anyway. I confess that > I've had some problems like this, and we chose not to use empty(), as > sometimes 0 or false makes sense as a valid value. > That is exactly as the doc

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Lynn
On Mon, Oct 30, 2023 at 1:24 PM Alessandro Rosa wrote: > Hi, > > I have posted a new RFC at this link > https://wiki.php.net/rfc/empty_function > where I suggested some improvements to the standard built-in empty() > function and provided a number of examples. > > Thanks, > > Alessandro Rosa > WE

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Marcos Marcolin
Hello, I understand that the idea of ​​the RFC is about some behaviors of empty(), e.g.: ```php $var = ''; var_dump(empty($var)); // true $var= []; var_dump(empty($var)); // true $var= 0; var_dump(empty($var)); // true var_dump(empty($empty)); // true $var= true; var_dump(empty($var)); // f

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Aleksander Machniak
On 30.10.2023 13:24, Alessandro Rosa wrote: Hi, I have posted a new RFC at this link https://wiki.php.net/rfc/empty_function where I suggested some improvements to the standard built-in empty() function and provided a number of examples. Forget about deprecating empty(). No chance I'd vote for

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Kamil Tekiela
Hi, I don't understand what you are proposing and what problem you are trying to fix. The RFC is not explaining things well.

Re: [PHP-DEV] Re: Basic Type Alias

2023-10-30 Thread Erick de Azevedo Lima
File-based are the worst. Let the types be attached to namespaces. As we have autoloaders, everyone is free to load them however they want (PSR-4, file, custom autoloader, whatever). Best regards, Erick Em seg., 30 de out. de 2023 às 08:34, G. P. B. escreveu: > On Sun, 29 Oct 2023 at 20:36, Ro

[PHP-DEV] New RFC : empty() function

2023-10-30 Thread Alessandro Rosa
Hi, I have posted a new RFC at this link https://wiki.php.net/rfc/empty_function where I suggested some improvements to the standard built-in empty() function and provided a number of examples. Thanks, Alessandro Rosa WEB : http://alessandrorosa.altervista.org LINKEDIN : https://www.linkedin.com

Re: [PHP-DEV] Re: Basic Type Alias

2023-10-30 Thread G. P. B.
On Sun, 29 Oct 2023 at 20:36, Robert Landers wrote: > My personal opinion is that file-based type aliases would be the best. > It solves an immediate problem while introducing a problem most people > will never have (needing to reuse the type aliases elsewhere). It > allows them to be used in fun

Re: [PHP-DEV] Discussion - Anti-null coercion

2023-10-30 Thread Ilija Tovilo
Hi Robert On Sun, Oct 29, 2023 at 7:31 PM Robert Landers wrote: > > Hello Internals, > > We currently have a null coercion operator: ??, but we lack an > anti-null coercion operator. > ... > fn() => > ($_SERVER['HTTP_X_MY_HEADER'] ?? null) > ? md5($_SERVER['HTTP_X_MY_HEADER']) > : null; > .