>
> The change in null handling. We have a codebase that dates to 1998. It's
> fairly well written. Upgrading to 8 was a major effort (4 devs, 2 QA) that
> took almost a year due to the change in null handling. We have 40 XML and
> JSON APIs with various banks. Elements may or may not exist. The database,
> which is 45TB, has nulls all over it. And when it was all "upgraded" to run
> on PHP8 all we really got that was useful to us is two new string
> functions. And a codebase that now has ?? as every third line.


This is probably my biggest stylistic gripe with PHP 8+ just because of how
ubiquitous the "undefined array index" scenario is.

In JavaScript:
```
let obj = {};
obj['undefinedkey'] === undefined;
let str = `Welcome, ${obj['undefinedkey'] ?? 'Customer'}!`;
if( obj['undefinedkey'] || $obj['undefinedkey2'] ) doSomething();
```

In PHP:
```
$obj = [];
($obj['undefinedkey'] ?? null) === null;
$str = "Welcome, " . ($obj['undefinedkey'] ?? 'Customer') . "!";
if( ( $obj['undefinedkey'] ?? null) || ($obj['undefinedkey2'] ?? null) )
doSomething();
```

On Mon, Apr 10, 2023 at 8:35 AM Jeffrey Dafoe <jda...@fsx.com> wrote:

>
> > I wonder about this every time I hear this claim. What exactly changed
> in PHP
> > 8.0 that made the upgrade path so difficult? The upgrade to PHP 9 may be
> a
> > little more difficult because of some of the recent deprecations, but
> that's
> > still years ahead of us. So what's exactly driving people away from PHP
> 8?
> > Why is the adoption dwindling?
>
> The change in null handling. We have a codebase that dates to 1998. It's
> fairly well written. Upgrading to 8 was a major effort (4 devs, 2 QA) that
> took almost a year due to the change in null handling. We have 40 XML and
> JSON APIs with various banks. Elements may or may not exist. The database,
> which is 45TB, has nulls all over it. And when it was all "upgraded" to run
> on PHP8 all we really got that was useful to us is two new string
> functions. And a codebase that now has ?? as every third line.
>
> -Jeff
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: https://www.php.net/unsub.php
>
>

Reply via email to