Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.1 issue - passing a null parameter #397

Closed
j2s opened this issue Nov 11, 2022 · 6 comments
Closed

PHP 8.1 issue - passing a null parameter #397

j2s opened this issue Nov 11, 2022 · 6 comments

Comments

@j2s
Copy link

j2s commented Nov 11, 2022

Using PHP 8.1 I see:
Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in Kint\Renderer\RichRenderer->renderChildren() (line 329 of vendor/kint-php/kint/src/Renderer/RichRenderer.php).

Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in Kint\Object\BasicObject->getModifiers() (line 134 of vendor/kint-php/kint/src/Object/BasicObject.php).

This is in in v3.3 (used in Drupal 9) but also seems to be present in current version 4.2.0 (for RichRenderer.php)

This is documented in https://www.php.net/manual/en/migration81.deprecated.php
The fixes are straightforward changing strlen() for !empty() etc

@jnvsor
Copy link
Member

jnvsor commented Nov 11, 2022

This should have been fixed in 7299750 - are you sure you're using 4.x? Can you tell me which line it's occurring on in 4.2.3?

@j2s
Copy link
Author

j2s commented Nov 12, 2022 via email

@jnvsor
Copy link
Member

jnvsor commented Nov 12, 2022

Yes I know what the code looks like, but what line is the error message reporting exactly? There's no code path in renderTab() that would return a null, they all return strings so this error can't be happening there in 4.x.

Otherwise, what's your input data? Can you give a snippet to reproduce it?

@j2s
Copy link
Author

j2s commented Nov 12, 2022

Hi
I encountered the problem in Drupal 9 which uses v3.3. I then had a look at the latest 4.x code and could see that the same related line was there - in 3.3. its 329: if (\strlen($result)) {
I tried to get the latest kint to load via composer but there were too many conflicts.
If you feel the strlen() will now never have a null value - then that is all good!
I need to see how to get the Drupal devel module to pull in the 4.x code
Thanks for your work on this

@jnvsor
Copy link
Member

jnvsor commented Nov 12, 2022

Alright, then I'm going to close this

I tried to get the latest kint to load via composer but there were too many conflicts

Kint only has php version and dev dependencies. If their version requirements are too strict you should be able to load the phar and load composer autoloader in append mode as a hacky workaround

@jnvsor jnvsor closed this as not planned Won't fix, can't repro, duplicate, stale Nov 12, 2022
@j2s
Copy link
Author

j2s commented Nov 15, 2022

Drupal users see https://gitlab.com/drupalspoons/devel/-/issues/416 on how to update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants