Open tiefenb opened 2 years ago
@ryancramerdesign - another one that I don't think has been reported:
PHP Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /modules/LanguageSupport/LanguageSupportPageNames.module:257
1× | PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in .../wire/core/WireMail.php:222 |
---|---|
1× | PHP Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in .../wire/core/WireMail.php:151 |
Not sure if there is a newer version or they have already been reported... ProCache 403
1× | PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in .../site/modules/ProCache/ProcessProCache.module:1623
1× | PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in .../site/modules/ProCache/ProcessProCache.module:1503
3× | PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in .../site/modules/ProCache/ProCacheTests.php:312
1× | PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in .../site/modules/ProCache/ProcessProCache.module:1400
1× | PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in .../site/modules/ProCache/ProcessProCache.module:1459
Thanks @BernhardBaumrock @adrianbj @jlahijani @matjazpotocnik
Hi Ryan,
I think you introduced a deprecation with 3.0.204 today:
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/jlahijani/Sites/processwire-dev/wire/core/Inputfield.php on line 1245
PHP Deprecated: dirname(): Passing null to parameter #1 ($path) of type string is deprecated in ....wire\core\Modules.php:2016 PHP Warning: Undefined array key "InputfieldPageTableNext" in ...\wire\core\Modules.php:2014
I think those warnings showed when installing a module and something went wrong, but nevertheless, I'm reporting it.
PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in ...\Inputfield\InputfieldTextTags\InputfieldTextTags.module:221
PHP Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in ...\wwwroot\wire\modules\Process\ProcessPageClone.module:199
@adrianbj, it's already reported by Jonathan
187× | PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in .../wire/core/Inputfield.php:1245
PHP Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in [.../modules/Inputfield/InputfieldPage/InputfieldPage.module:595]
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /wire/core/Selectors.php:145
@ryancramerdesign Check out Rector to take care of this kind of thing.
Video: https://youtu.be/Kej0IY_JLF0 PHP8.1 ruleset: https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#php81
PHP Deprecated: number_format(): Passing null to parameter #1 ($num) of type float is deprecated in [.../ProcessDatabaseBackups/ProcessDatabaseBackups.module:243]
Hi @ryancramerdesign - I know you are ticking through these pretty well, but I just wanted to make the point that PHP 8.0's active support ends in November this year. Yes, there is security support for another year, but I still think it's important that we start moving our servers to 8.1 fairly soon.
Thanks!
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /wire/core/Selectors.php:145
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/wire/core/Modules.php on line 1628
PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in wire/core/Modules.php:1626
PHP Deprecated: ctype_alnum(): Argument of type bool will be interpreted as string in the future in [.../wire/core/Modules.php:1896]
Thanks, I've pushed fixes for all the above mentioned items.
@matjazpotocnik The dirname() one you mentioned above seems to be a different issue that we shouldn't hide the notice for, so I'm curious how to duplicate that one? Is InputfieldPageTableNext a module that was previously installed but removed from the file system, or something like that?
@ryancramerdesign, sorry, I don't remember how I got those warnings; I will report it if I can replicate it again.
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in wire/modules/Fieldtype/FieldtypeDatetime.module:387
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in wire/modules/Fieldtype/FieldtypeDatetime.module:407
I am also still seeing the previously reported:
Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /InputfieldPageAutocomplete/InputfieldPageAutocomplete.module:316
PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in ...\Process\ProcessPageLister\ProcessPageLister.module:1592
PHP Deprecated: auto_detect_line_endings is deprecated in ...\modules\ProcessExportProfile\ProcessExportProfile.module:96
This is on PHP 8.2.0:
Deprecated: Creation of dynamic property ProcessWire\InputfieldFile::$maxFilesize is deprecated in ...\wire\modules\Inputfield\InputfieldFile\InputfieldFile.module on line 216
https://php.watch/versions/8.2/dynamic-properties-deprecated
I added public $maxFilesize;
property to class InputfieldFile
Note that utf8_encode and utf8_decode functions are also deprecated in PHP 8.2.0 (/wire/core/PWPNG.php and in /wire/modules/Markup/MarkupHTMLPurifier/htmlpurifier/HTMLPurifier.standalone.php).
@matjazpotocnik That's strange you are seeing that error for maxFilesize because it is a declared property already (see the init method). In addition the page you linked said that classes with get() and set() magic methods are not subject to this deprecation, and the InputfieldFile declares both of those methods (via inherit from WireData). Adding a public maxFilesize property to the class could break usage of it since it would not be known by the get() or set() methods.
My best guess is that maybe you came across this deprecation notice in some instance that instantiated the InputfieldFile class manually, rather than getting it from $modules->get('InputfieldFile') ? That would explain why the init method wasn't called, though wouldn't explain the get/set thing.
This warning is shown on every page edit that has an image filed on the template. It's shown even when I create a new field of type Files or Images. I uninstalled all site modules that use Inputfields...
@matjazpotocnik This maxFilesize one is definitely a bit of a mystery. I've just pushed an attempted fix, as I'm thinking the issue must be with an access to maxFilesize prior to it being defined in the init() method. Do you find the attempted fix resolves the PHP notice? Thanks.
@ryancramerdesign Yes, it does fix it.
@matjazpotocnik Great! Thanks for letting me know.
How should we continue with this topic? Since PHP 8.2. ist also out. Should we close it and open for each upcoming issue a single thread?
Has anybody some overview about processwire basic core how compatible it is now with PHP 8.1.0? I'm too afraid to upgrade now for most project since I have also many third party plugins and my feeling is not the best currently.
Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/site/modules/FieldtypeCombo/ComboSchema.php on line 224
Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/site/modules/FieldtypeTable/FieldtypeTable.module on line 502
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/site/modules/ProCache/ProcessProCache.module on line 1616
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/site/modules/ProCache/ProcessProCache.module on line 1496
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/site/modules/ProCache/ProCacheTests.php on line 312
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/site/modules/ProCache/ProcessProCache.module on line 1393
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/site/modules/ProCache/ProCacheTests.php on line 312
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/site/modules/ProCache/ProcessProCache.module on line 1452
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/site/modules/ProCache/ProCacheTests.php on line 312
1× PHP Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in .../wire/modules/Inputfield/InputfieldInteger.module:78 1× PHP Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in .../wire/modules/Inputfield/InputfieldInteger.module:80
Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in ../wire/core/WireInput.php on line 371
( added for reference https://processwire.com/talk/topic/28160-php-error-after-upgrading-to-php-81/ )
Deprecated: PDO::quote(): Passing null to parameter #1 ($string) of type string is deprecated in .../wire/core/WireDatabasePDO.php on line 1564 (user reported on the forum, posting here too)
Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in ../wire/core/WireInput.php on line 371
( added for reference https://processwire.com/talk/topic/28160-php-error-after-upgrading-to-php-81/ )
I've the same error:
ProcessWire: 3.0.210 PHP: 8.1.14 Webserver: Apache MySQL Server: 5.7.38 MySQL Client: mysqlnd 8.1.14
Auto-fixing most of these issues should be possible with a tool like Rector.
This is a clean install. Installer says ...
Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/virtuallyreal.games/htdocs/pw/wire/core/Session.php on line 287
Warning: session_name(): Session name cannot be changed after headers have already been sent in /var/www/virtuallyreal.games/htdocs/pw/wire/core/Session.php on line 291
Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/virtuallyreal.games/htdocs/pw/wire/core/Session.php on line 297
Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/virtuallyreal.games/htdocs/pw/wire/core/Session.php on line 298
Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/virtuallyreal.games/htdocs/pw/wire/core/Session.php on line 299
Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/virtuallyreal.games/htdocs/pw/wire/core/Session.php on line 300
Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/virtuallyreal.games/htdocs/pw/wire/core/Session.php on line 312
php 8.1.15 nginx 1.22.0 Was the -dev version of pw from the web site.
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in \wire\core\Process.php:378
Got another one in WireTextTools::markupToText
(also valid for Sanitizer::markupToText
) if it receives an empty string:
strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated
strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated
A simple fix would be to return early if $str
is empty
Ran into this one today: Function utf8_encode() is deprecated
. PWPNG.php line 118. I had to replace a PNG with a JPG in order to circumvent the issue.
@uudruid74 That would be some other issue, likely unrelated to PHP 8. It indicates that some output was sent (maybe a PHP notice, warning or error?) before it could start the session. Best bet would be to view the HTML output source in your browser to see if there are some PHP notices at the top of the output. It might be nginx related since PW doesn't technically support nginx, though I know many are using it, but I just don't have experience with it myself.
@romaincazier Thanks, I am adding a (string) typecast to the top of the WireTextTools::markupToText method. The Sanitizer::markupToText method already has a string typecast at the top, so I'm not sure why you might be seeing the error there, but please let me know if it persists.
@matjazpotocnik Thanks, got it.
@eelke That one should already be fixed on the dev branch.
PHP Warning: Undefined array key "" in /wire/core/Modules.php:3698
(not sure if it's specific to php 8.1 or it's because of changes in modules.php file lately).
EDIT: fixed in PW 3.0.219
PHP Deprecated: strpos(): Passing null to parameter #2 ($needle) of type string is deprecated in /wire/core/ModulesInfo.php:655 PHP Deprecated: strpos(): Passing null to parameter #2 ($needle) of type string is deprecated in /wire/core/ModulesInstaller.php:302
EDIT: fixed in commit
PHP Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in [...\Process\ProcessPageSearch\ProcessPageSearch.module:644]
protected function buildSelector() {
$selector = ''; // for regular ProcessPageSearch
$input = $this->wire('input');
// search query text
$q = $input->whitelist('q');
if(strlen($q)) { <- line 644
@ryancramerdesign [PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module:1085]
@ryancramerdesign - you might already be thinking the same, but can I please suggest that all these deprecations be fixed before the next stable release of PW. Please keep in mind that PHP 8.0 will be EOL'd in November, and 8.1 won't have active support by then either.
Thank you.
suggest that all these deprecations be fixed before the next stable release of PW
They all are except for the 2 above. I return to this thread regularly, just not daily. :)
Sorry - I know you are regularly ticking them off which is greatly appreciated!
ErrorException: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /wire/modules/Inputfield/InputfieldSelect.module:917
I have tested Processwire with the upcoming 8.1.0 Version of PHP and got some deprication warnings and errors: