phalcon / cphalcon

High performance, full-stack PHP framework delivered as a C extension.
https://phalcon.io
BSD 3-Clause "New" or "Revised" License
10.78k stars 1.97k forks source link

PHP 8.1 deprecation of null arguments #15984

Closed Deathamns closed 2 years ago

Deathamns commented 2 years ago

With the recent v5.0.0RC1 and PHP 8.1 I'm seeing entries in my log files about passing null parameters to built-in functions.

For example calling Phalcon\Http\Request\getLanguages() when the HTTP_ACCEPT_LANGUAGE header is not present, I get messages such as: preg_split(): Passing null to parameter #2 ($subject) of type string is deprecated

https://github.com/phalcon/cphalcon/blob/b6e86887708578ec853b6c08b9ba0825f9a43566/phalcon/Http/Request.zep#L1404

These deprecation messages might surface in other places as well, I've only noticed this specific case.

Passing null to non-nullable parameters of built-in functions PHP 8.1 : Passing null to non-nullable arguments of internal functions is deprecated

niden commented 2 years ago

We definitely need to address these. I will try and get as much reporting as possible from our testing suite but that might not cover a lot of areas that could be problematic.

Anything else you see @Deathamns please report it. I am going to address this one shortly.

niden commented 2 years ago

Resolved in https://github.com/phalcon/cphalcon/pull/15985

Thank you @Deathamns

Jeckerson commented 2 years ago

Released in v5.0.0RC2

dz3n commented 2 years ago

@niden Deprecated: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in

Same issue if you using StringLength validator with nullable column

niden commented 2 years ago

Resolved in https://github.com/phalcon/cphalcon/pull/15995

@dz3n Thank you for reporting this!

Deathamns commented 2 years ago

https://github.com/phalcon/cphalcon/blob/b6e86887708578ec853b6c08b9ba0825f9a43566/phalcon/Mvc/View/Engine/Volt.zep#L191-L202

niden commented 2 years ago

Resolved in https://github.com/phalcon/cphalcon/pull/16004