Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
NB the problem applies to Drupal core and many different modules - flag module is just an example.
While looking at the flag module with devel
I see get the following stack trace, when I try to inspect a few core containers everything appears ok
Steps to reproduce
1) drush en devel kint flag
2) visit /devel/container/service/flag
2 is the same as going to /devel/container/service page.
getting a list of all containers - then typing flag into the search box and hitting the details button
The website encountered an unexpected error. Please try again later.
Error: Cannot access protected property Drupal\Core\Utility\Error::$blacklistFunctions in Drupal\Core\Utility\Error::getLastCaller() (line 116 of core/lib/Drupal/Core/Utility/Error.php).
Drupal\Core\Utility\Error::getLastCaller(Array) (Line: 65)
_drupal_error_handler_real(8, 'Undefined property: Drupal\Core\Config\ImmutableConfig::$overriddenData', 'XXXXX/drupal/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php', 132, Array) (Line: 552)
_drupal_error_handler(8, 'Undefined property: Drupal\Core\Config\ImmutableConfig::$overriddenData', 'XXXXX/drupal/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php', 132, Array)
ReflectionProperty->getValue(Object) (Line: 132)
Doctrine\Common\Util\Debug::export(Object, 1) (Line: 132)
Doctrine\Common\Util\Debug::export(Object, 2) (Line: 107)
Doctrine\Common\Util\Debug::export(Array, 3) (Line: 132)
Doctrine\Common\Util\Debug::export(Object, 4) (Line: 132)
Doctrine\Common\Util\Debug::export(Object, 5) (Line: 132)
Doctrine\Common\Util\Debug::export(Object, 6) (Line: 24)
Drupal\devel\Plugin\Devel\Dumper\DoctrineDebug->export(Object) (Line: 50)
Drupal\devel\Plugin\Devel\Dumper\DoctrineDebug->exportAsRenderable(Object, Object) (Line: 127)
Drupal\devel\DevelDumperManager->exportAsRenderable(Object, Object) (Line: 176)
Drupal\devel\Controller\ContainerInfoController->serviceDetail('flag')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comment | File | Size | Author |
---|---|---|---|
#18 | devel.ksm_.2857361.18.patch | 711 bytes | AdamPS |
Comments
Comment #2
willzyx CreditAttribution: willzyx commented@martin107 Thanks for reporting.
Please, can you post drupal/devel/flag version used? I'm trying to reproduce the issue without success using drupal 8.x-3.x flag 8.x-4.0-alpha1 devel 8.x-1.x-dev/8.x-1.0-rc1
Thanks
also this seems to be stricty related with the following core bug #2833979: Config::resetOverriddenData() should reset overriddenData value not remove the class property
Comment #3
martin107 CreditAttribution: martin107 as a volunteer commentedThe flag version was 8.x-4.x
php 7.1.1
Drupal8 - 8.3.x
I will spend a little time on Sunday trying to find a core module that breaks ...
Comment #4
martin107 CreditAttribution: martin107 as a volunteer commentedI always want the "step to reproduce" list to be as small as possible
kint and the flag module do not need to be installed to reproduce this stack trace.
1) drush en devel
2) go to /devel/container/service - type service_container in the search box or visit
/devel/container/service/service_container
I will try and debug soon ... I am just short on time at the moment..
Comment #5
BeauTownsend CreditAttribution: BeauTownsend commentedSimilar issue for me while attempting to execute kint in hook_preprocess_views_view_unformatted() from a module. If it matters, the view is outputting a custom Content Entity that i created. The view itself is a very simple output of entities. I didn't change any format or field settings.
Steps to reproduce:
drush qd
drush en devel -y
drush en kint -y
drush en views -y
drupal generate:module
command.drupal generate:entity:content
command.Sample of hook_preprocess_views_view_unformatted:
Outputting the keys does not cause on error and works as expected:
Resultant call stack:
Comment #6
mariusdiacu CreditAttribution: mariusdiacu commentedI'm having the same problem with basic Drupal install, devel and kint modules enabled. Here are the steps:
1. I installed Drupal 8.3.1, enabled devel and kint modules. Also, admin_menu is installed, but it has nothing to do with it (tested).
2. Created a basic theme, with themetest.info.yml as follows:
3. Created file themetest.theme:
4. Create a basic page node and promoted it to homepage.
5. Access homepage. The bug does not reproduce for node pages, but when accessing teasers of the node, I get the same error as above. No method within devel module works. Neither print_r worked for me.
Comment #7
mariusdiacu CreditAttribution: mariusdiacu commentedAfter some investigations I found that on the
$variables['elements']['#node']
, which is an instance ofDrupal\node\Entity\Node
class, in the protected$values
a view is stored (Drupal\views\ViewExecutable
).This is the entire homepage view, which is attached to the values property of the node. When the
kint
is executed, theReflectionProperty
class used to get the values cannot get therow_index
and throws this error.Comment #8
yi_jiang CreditAttribution: yi_jiang commentedso how could I avoid this?
Comment #9
jeremyr CreditAttribution: jeremyr as a volunteer commentedJust ran into this problem too while working with a views field. I added
use Drupal\node\Entity\Node;
to the top of the file and now kint works.Comment #10
colanSeems like you need to
use
whatever you're piping throughdd()
. In my case it was$form_state->getFormObject()
so I neededDrupal\Core\Form\FormState
.Comment #11
chamilsanjeewa CreditAttribution: chamilsanjeewa as a volunteer and commentedAdded below two lines before kint, its works for me.
require_once DRUPAL_ROOT . '/modules/contrib/devel/kint/kint/Kint.class.php';
Kint::$maxLevels = 3;
Comment #12
andeersg CreditAttribution: andeersg commentedI have the same problem on a Drupal 8.4 site, and I don't use the flag module.
Comment #13
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedI had no luck with #9/#10 - presumably I didn't figure out the right class. I didn't try for long as this seems too fiddly to keep adding different use statements for every call to ksm (unless there are only a handful needed for the whole of Core).
#11 works, but again it seems to be a bit of a guess. It assumes that the problem occurs more than 3 levels deep, and that the developer doesn't need to click past the 3rd level when debugging.
#12 I have clarified the summary that it isn't just the flag module.
It would be great if someone could figure out a universal solution. The kint code calls
$property->setAccessible( true );
so I don't understand why that doesn't work. Many protected fields seem to be fine, so why do some others fail?Comment #14
ggeerolf CreditAttribution: ggeerolf commentedAnyone found a solution to this problem yet ?
Comment #15
nicolaj.knudsen@gmail.com CreditAttribution: nicolaj.knudsen@gmail.com commentedThis is a problem when looking at many different core objects, which makes exploring system objects very hard and tedious.
Here is an even simpler way to reproduce it, execute this line from a clean install with kint and devel (to execute the code) enabled:
kint(\Drupal::config('system.theme'));
I created this issue before finding this thread, that can be closed as a duplicate.
I tested this with Drupal core 8.4.4 and Devel 8.x-1.2
Comment #16
jedihe CreditAttribution: jedihe as a volunteer commented#9 worked for me, I was trying to inspect a $file object loaded this way:
After I added
use Drupal\node\Entity\Node;
the error went away and I was able to inspect the $file variable (as an array).Comment #17
jnicola CreditAttribution: jnicola at Oregon Health & Science University (OHSU) commentedI'm encountering this error as well. Working on a form used for roles on groups in the Group module, I am attempting to run
dpm($form_state->getFormObject());
and I the afforementioned error.Comment #18
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedThis seems to be a bug in the upstream library and I have raised this issue.
Sadly devel is stuck on a very very old unsupported version of the library. Clearly the right way forward is this #2859114: Integrate latest kint library
In the meantime, here is a patch that works for me.
Comment #19
elijahoyekunle CreditAttribution: elijahoyekunle as a volunteer commentedAlrighty.
I can confirm that the patch in #18 works for me.
Comment #20
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedGreat - in that case please could you set RTBC to help us get it committed.
Comment #21
elijahoyekunle CreditAttribution: elijahoyekunle as a volunteer commentedHow do I do that? :)
Comment #22
elijahoyekunle CreditAttribution: elijahoyekunle as a volunteer commentedComment #23
AdamPS CreditAttribution: AdamPS at AlbanyWeb commented@elijahoyekunle Edit the status field to "Reviewed & tested by the community"
Comment #24
elijahoyekunle CreditAttribution: elijahoyekunle as a volunteer commentedComment #25
altrugon CreditAttribution: altrugon at Affinity Bridge commentedI'm confirming too that patch in #18 works. I hope this get merged into the new version soon.
Thanks for all the hard work.
Comment #26
willzyx CreditAttribution: willzyx commented@all thanks for contributing. Since the patch changes the kint code I think that is not a good idea commit it.
Bugs in libraries used by devel should be fixed in those projects.
Mark this issue as won't fix.
@see #2839515: Remove Kint module and create a kint dumper plugin in devel for an alternative solution.
Thanks
Comment #27
DuneBL#18 solve my issue...
Comment #28
paul_leclerc CreditAttribution: paul_leclerc as a volunteer commented#18 saved my life :)
In your composer.json
Comment #29
paulkerrigan CreditAttribution: paulkerrigan at Consult and Design International commented#18 doesn't change anything for me.
Comment #30
AltaGrade CreditAttribution: AltaGrade commented#18 worked in our case too.