Jump to content

PHP 8.0 is here


Go to solution Solved by bfarber,

Recommended Posts

PHP 8.0.0 has been released. Some bugs that I've found in a couple of minutes of testing:

  • There are a bunch of deprecation warnings for required parameters following optional parameters - from my search with the regex
    function\s*\w+\s*\([^=)]*=[^)]*,\s*\$[^,)=]*[,)]
    there are 47 instances of this in the suite. It should be safe to remove all of the offending default parameters, since they can never be utilised.
  • The cms lang key can_edit_item_message_record is invalid - it contains %S rather than %s, which causes the page to (randomly?) 500.
  • Fatal error: Cannot make static method XMLReader::open() non static in class IPS\Xml\_XMLReader in .../system/Xml/XMLReader.php on line 34 (this might be a fun one to fix - it's a PHP 8 change that isn't compatible in either direction - https://www.php.net/manual/en/xmlreader.open.php#refsect1-xmlreader.open-changelog - you probably have to make a new method that delegates instead)
  • TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given from statusContainer.phtml:133 (when viewing a feed containing status updates)
  • PHP Fatal error:  Unparenthesized `a ? b : c ? d : e` is not supported. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in .../applications/calendar/widgets/upcomingEvents.php on line 153

If I come across any more issues, I'll add them in this topic, and encourage others to do the same.

Edited by Colonel_mortis
Unparenthesized nested ternary
Link to comment
Share on other sites

2 hours ago, RevengeFNF said:

You noticed any change in terms of performance?

I need to setup a test server for this.

I've only been playing around with it IN_DEV so far, but I'm not noticing a difference. I don't think the JIT compiler is expected to make too much difference for web apps, but I would love to be wrong there.

Link to comment
Share on other sites

  • Solution

I'm finding it to be a lot faster locally with IN_DEV enabled actually.

I had to adjust the regex you supplied (it didn't account for typed parameters like function x( $member=NULL, \IPS\Member\Group $group ) ) but it was pretty helpful nevertheless. Thanks! I found a few more similar issues (method_exists() calls on NULL for instance) but nothing you hadn't reported. Let us know if you spot anything else.

Link to comment
Share on other sites

  • 2 weeks later...
On 12/1/2020 at 2:58 AM, bfarber said:

Let us know if you spot anything else.

If you've not discovered it yet, I'm also getting

TypeError: array_merge(): Argument #2 must be of type array, null given (0)

in \IPS\forums\Forum::formatFormValues:1120 (neither $whereString nor $whereParams are defined as far as I and my IDE can tell, and $where seems to be unused).

 

Also there are a few places where you have

new\DateInterval(

which seems to now be lexed as calling the function DateInterval in the namespace new, rather than applying the new operator to the root-namespace class DateInterval [1].

Edited by Colonel_mortis
RFC reference
Link to comment
Share on other sites

I fixed the DateInterval issue.

I can't reproduce or see the first issue however, and my code lines aren't matching up.

On 12/13/2020 at 8:36 AM, Colonel_mortis said:

in \IPS\forums\Forum::formatFormValues:1120 (neither $whereString nor $whereParams are defined as far as I and my IDE can tell, and $where seems to be unused).

What do you have on line 1120?

Link to comment
Share on other sites

7 hours ago, bfarber said:

I fixed the DateInterval issue.

I can't reproduce or see the first issue however, and my code lines aren't matching up.

What do you have on line 1120?

Ugh it's the patch from ticket #70349 again. Looking at the patch again it doesn't seem to break either of the things that I've run into, so it seems I somehow managed to misapply it (my linux git doesn't like that patch file at all, it's missing the a/ and b/ prefixes). Apologies for wasting your time twice for that.

Edited by Colonel_mortis
Link to comment
Share on other sites

  • 2 weeks later...

I run my site via Docker, and didn't specify the version of the PHP-FPM image I wanted to use and during a server migration I couldn't get past this error:

www_1      | 2020/12/23 17:46:29 [error] 35#35: *9 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /var/www/brfcs/mb/system/3rd_party/JShrink/Minifier.php on line 546" while reading response header from upstream, client: 194.35.116.206, server: tugay.brfcs.com, request: "GET /mb/ HTTP/2.0", upstream: "fastcgi://172.19.0.3:9000", host: "tugay.brfcs.com"

Turns out JSShrink has issues with PHP 8 at the moment ...

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...