Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread David Gebler
On Mon, Dec 12, 2022 at 10:20 PM Dan Liebner wrote: > As the RFC points out, "Some languages, such as JavaScript, do not consider > accesses to undefined array keys to be an error condition at all, and allow > such an operation to be performed silently." > It is by definition an error condition

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Derick Rethans
On 13 December 2022 15:55:41 GMT, Thomas Hruska wrote: >On 12/13/2022 7:15 AM, Derick Rethans wrote: >> On Mon, 12 Dec 2022, Thomas Hruska wrote: >> >>> On 12/12/2022 3:52 PM, Derick Rethans wrote: On 12 December 2022 22:20:27 GMT, Dan Liebner wrote: > It has been proposed to

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Dan Liebner
> Can you expand a bit on how you think distinguishing "undefined" from "null" would help? First off, I would be perfectly happy if undefined array/object index accesses went back to raising E_NOTICE. Undefined variables already resolve to NULL so in that sense NULL is already the "undefined"

Re: [PHP-DEV] Remove PHP-x.y.* git branches

2022-12-13 Thread Tim Düsterhus
Hi On 12/13/22 18:55, Sara Golemon wrote: Why do you want to remove these branches? I agree that they have minimal value especially since the tags are the actual release commit (and for release process versions often represent a spur off the release branch), but the cost in the repo is

Re: [PHP-DEV] Remove PHP-x.y.* git branches

2022-12-13 Thread Sara Golemon
On Tue, Dec 13, 2022 at 11:31 AM Michael Voříšek - ČVUT FJFI < voris...@fjfi.cvut.cz> wrote: > Hello everyone, > > I am the author of https://github.com/php/php-src/issues/10007 proposal > and I would ask you for the green light to do so. > > Why do you want to remove these branches? I agree

[PHP-DEV] Re: Remove PHP-x.y.* git branches

2022-12-13 Thread Ben Ramsey
On 12/13/22 11:30, Michael Voříšek - ČVUT FJFI wrote: Hello everyone, I am the author of https://github.com/php/php-src/issues/10007 proposal and I would ask you for the green light to do so. There are two kinds of unusefull branches: a) the PHP-x-y-* branches - I would restrict the removal of

[PHP-DEV] Remove PHP-x.y.* git branches

2022-12-13 Thread Michael Voříšek - ČVUT FJFI
Hello everyone, I am the author of https://github.com/php/php-src/issues/10007 proposal and I would ask you for the green light to do so. There are two kinds of unusefull branches: a) the PHP-x-y-* branches - I would restrict the removal of branches that HEAD commit matches git tag HEAD-1

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Craig Francis
On 13 Dec 2022, at 15:45, Rowan Tommins wrote: > Although presumably they return null rather than an empty string precisely so > that users can check if the value was provided, without providing an extra > method equivalent to isset($_GET['q']), e.g. > > [...] > > For cases where you don't

Re: [PHP-DEV] [RFC] Asymmetric Visibility, with readonly

2022-12-13 Thread Claude Pache
> Le 13 déc. 2022 à 16:34, Claude Pache a écrit : > > > Hi, > > As of today, the following declarations are rejected as syntax errors: > > ```php > class C { > $a; > int $b; > } > ``` > > while the following declarations are accepted with implicit `public` > visibility: > >

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Rowan Tommins
On 13/12/2022 16:08, Dan Liebner wrote: Can I also just point out that by current definitions the "null coalescing operator" isn't properly named, it should be the "undefined/null coalescing operator". The only reason it is able to get away with not raising an error for undefined variables is

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Larry Garfield
On Tue, Dec 13, 2022, at 10:39 AM, Deleu wrote: >> And yes, I used to work on a system that didn't do that properly. (TYPO3, >> ~800,000 LOC) It took me a few weeks, but we still managed to fix all of >> these issues in mostly one-person-month, mostly with dropping "?? null" >> around in

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Deleu
> > Anyone surprised by any of the changes in recent versions that boil down > to "know your types and know if you actually have a variable" has been > living under a rock for the last 20 years. None of this has been a > secret. The language has been providing more and more tools to >

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Larry Garfield
On Tue, Dec 13, 2022, at 9:55 AM, Thomas Hruska wrote: > On 12/13/2022 7:15 AM, Derick Rethans wrote: >> On Mon, 12 Dec 2022, Thomas Hruska wrote: >> >>> On 12/12/2022 3:52 PM, Derick Rethans wrote: On 12 December 2022 22:20:27 GMT, Dan Liebner wrote: > It has been proposed to make

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Dan Liebner
Can I also just point out that by current definitions the "null coalescing operator" isn't properly named, it should be the "undefined/null coalescing operator". The only reason it is able to get away with not raising an error for undefined variables is that it's described as "syntactic sugar" for

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Lynn
On Tue, Dec 13, 2022 at 4:55 PM Thomas Hruska wrote: > > Not for those of us that run the package managed version of PHP in > Ubuntu Server LTS it hasn't. > > https://wiki.ubuntu.com/Releases > > PHP 8.x is brand new as of *next year* from the perspective of those who > patiently wait for

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Thomas Hruska
On 12/13/2022 7:15 AM, Derick Rethans wrote: On Mon, 12 Dec 2022, Thomas Hruska wrote: On 12/12/2022 3:52 PM, Derick Rethans wrote: On 12 December 2022 22:20:27 GMT, Dan Liebner wrote: It has been proposed to make the error level of "Undefined index" configurable so that teams and

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Rowan Tommins
On 13/12/2022 14:32, Craig Francis wrote: Most frameworks return NULL when the user has not provided the value: $search = $request->input('q'); // Laravel $search = $request->get('q'); // Symfony $search = $this->request->getQuery('q'); // CakePHP $search =

Re: [PHP-DEV] [RFC] Asymmetric Visibility, with readonly

2022-12-13 Thread Claude Pache
> Le 11 déc. 2022 à 20:18, Larry Garfield a écrit : > > On Thu, Dec 1, 2022, at 12:31 PM, Tim Düsterhus wrote: >> Hi >> >> On 11/29/22 21:29, Larry Garfield wrote: >>> Thank you everyone for the feedback. Based on this thread, we've made two >>> changes to the RFC: >>> >>> 1. We've moved

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Andreas Leathley
On 13.12.22 13:53, Dan Liebner wrote: It breaks my app. Does that count? This sounds like you completely ignore notices in your application yet elevate warnings to exceptions/errors. It would be better to log both notices and warnings without generating exceptions/errors, and look through

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Craig Francis
On 13 Dec 2022, at 12:39, Rowan Tommins wrote: > On 13/12/2022 10:11, Craig Francis wrote: >> The null value can come from many sources (e.g. GET/POST/COOKIE/databases) > > > These two examples are interesting in conjunction: $_GET, $_POST, and > $_COOKIE will never contain null values unless

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Derick Rethans
On Mon, 12 Dec 2022, Thomas Hruska wrote: > On 12/12/2022 3:52 PM, Derick Rethans wrote: > > On 12 December 2022 22:20:27 GMT, Dan Liebner wrote: > > > > > It has been proposed to make the error level of "Undefined index" > > > configurable so that teams and individual developers can decide >

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Derick Rethans
On Mon, 12 Dec 2022, Rowan Tommins wrote: > On 12 December 2022 22:20:27 GMT, Dan Liebner wrote: > >Here's my biggest criticism: the change essentially forces this: > >$arr['key'] > > > >to be rewritten as this (or some other intolerably bad alternative): > >isset($arr) && isset($arr['key']) &&

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Rowan Tommins
On 13/12/2022 12:53, Dan Liebner wrote: It breaks my app. Does that count? The only way a Warning can break an application is if you're running a custom handler which promotes it to an error. If that is your case, then blaming PHP is a little bit like programming your car to do an emergency

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Dan Liebner
> No, code doesn't break. It now shows a warning instead of an error. There is no behavioural change. It breaks my app. Does that count? And didn't you follow up by referencing this as "adding settings that change behaviour"? Does it change behavior or not? > Adding a configuration setting to

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Rowan Tommins
On 13/12/2022 10:11, Craig Francis wrote: undefined indexes are a classic, but once you've found them all (the tricky bit), it often makes your code better, and helps identify mistakes (similar to undefined variables). [...] The null value can come from many sources (e.g.

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Robert Landers
On Tue, Dec 13, 2022 at 11:16 AM Andreas Leathley wrote: > > On 13.12.22 11:01, Robert Landers wrote: > > intended: ($a['foo'] ?? null) || ($a['bar'] ?? null) > > Further, writing code like this increases the number of opcodes needed > > to perform relatively simple logic by ~150%, increasing

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Andreas Leathley
On 13.12.22 11:01, Robert Landers wrote: intended: ($a['foo'] ?? null) || ($a['bar'] ?? null) Further, writing code like this increases the number of opcodes needed to perform relatively simple logic by ~150%, increasing end-user latency and spending CPU cycles somewhat needlessly. I think it

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Craig Francis
On 12 Dec 2022, at 23:36, Thomas Hruska wrote: > I suspect many people are in a similar holding pattern who are currently > running packaged 7.4.x and are just now discovering all of the changes for > PHP 8.x as they are planning out their system upgrade paths in the coming > months. While

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Robert Landers
On Tue, Dec 13, 2022 at 12:36 AM Thomas Hruska wrote: > > On 12/12/2022 3:52 PM, Derick Rethans wrote: > > On 12 December 2022 22:20:27 GMT, Dan Liebner wrote: > > > >> It has been proposed to make the error level of "Undefined index" > >> configurable so that teams and individual developers can