Closed scotself closed 2 years ago
Hi Scot, unfortunately devel is perpetually out of date. BasicObject
is from the previous major version, and the new one has these 8.1 deprecations fixed.
Not sure how hard it is to override devel to use 4.x instead of 3.x (Depends how many customizations they've made, if any) but that would be the way to fix it
Replacing these 2 calls with !empty instead does the trick. Thanks!
Yeah that'll probably work as a bandaid, unless the contents of the tab are falsey, like '0'
I have the same error messages as in https://github.com/kint-php/kint/issues/388#issue-1274079057 .
I updated to Devel 5.1.2 and Devel Kint Extras 1.1.1, but the errors still exist!
The following patch can help, but I think we need an official solution:
diff --git a/kint/src/Object/BasicObject.php b/kint/src/Object/BasicObject.php
index d69347e..60840da 100644
--- a/kint/src/Object/BasicObject.php
+++ b/kint/src/Object/BasicObject.php
@@ -131,7 +131,7 @@ class BasicObject
$out .= ' static';
}
- if (\strlen($out)) {
+ if (isset($out) && \strlen($out)) {
return \ltrim($out);
}
}
diff --git a/kint/src/Renderer/RichRenderer.php b/kint/src/Renderer/RichRenderer.php
index dcd39ee..98c76c3 100644
--- a/kint/src/Renderer/RichRenderer.php
+++ b/kint/src/Renderer/RichRenderer.php
@@ -326,7 +326,7 @@ class RichRenderer extends Renderer
foreach ($o->getRepresentations() as $rep) {
$result = $this->renderTab($o, $rep);
- if (\strlen($result)) {
+ if (isset($result) && \strlen($result)) {
$contents[] = $result;
$tabs[] = $rep;
}
Of course would !empty also work.
@webprogrammierer It doesn't matter what devel version you're using if the kint version you're using is now 2 major versions behind. Update kint, not devel.
Getting quite a few deprecated function notices on a Drupal site using Kint (Devel module).
Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in Kint\Renderer\RichRenderer->renderChildren() (line 329 of /var/www/html/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 /var/www/html/vendor/kint-php/kint/src/Object/BasicObject.php).
Replacing these 2 calls with !empty instead does the trick. Thanks!