Questions tagged [debugging]
Use it for questions about module and theme debugging (e.g. "How do I debug this situation?").
562
questions
0
votes
0
answers
94
views
Attribute Array to String Conversion Error
I'm getting this error now on most pages within a complex 9.5.3 site running PHP8.1:
Array to string conversion in
Drupal\Core\Template\AttributeArray->__toString() (line 77 of
core/lib/Drupal/...
-1
votes
1
answer
70
views
How to determine the cause of sudden "content encoding error"s for logged-in Drupal users? [closed]
One day last week or so, seemingly out of the blue, logged in sessions started to throw content encoding errors. The site still works fine for anonymous users.
There's nothing in error_log, clearing ...
1
vote
1
answer
85
views
Troubleshooting a Drupal HTTP 500 when there are no error log messages
I have reviewed some websites on how to troubleshoot HTTP 500 on a Drupal site and most often I have seen a PHP error by running drush ws in the console, however, I have been running into an oddity ...
0
votes
0
answers
44
views
Devel Debug Log produces empty messages
Drupal 9.4.5, Devel 4.1.5, Devel Debug Log 8.x-1.1
ddl function produces empty messages (they only have timestamp and id in the DB and at /admin/reports/debug. Other methods work correctly. Am I ...
3
votes
1
answer
104
views
Can phpstorm infer the entity type from \Drupal::entityTypeManager()->getStorage()?
Curious whether it's possible to get phpstorm to infer entity types when loading them via entity storage, e.g. \Drupal::entityTypeManager()->getStorage('node)->load(1), without needing to use ...
1
vote
1
answer
248
views
Enable xdebug on Lando using Pantheon recipe and PHPStorm
I am trying to enable xdebug on Lando using the pantheon recipe.
I have tried different tutorials, but PHPStorm does not seem to connect to Lando, or xdebug is not correctly enabled on Lando.
recipe: ...
0
votes
0
answers
31
views
How can I debug during installation?
I tried to install Drupal 9.4.2 in a MySQL-compatible database, but I got these errors.
How can I debug during installation or just print out the incompatible SQL statements?
1
vote
1
answer
280
views
Can I debug Twig templates with Twig Xdebug and Apache Netbeans?
I am trying to debug Twig templates in Drupal 9, using WAMP, Apache Netbeans, and the Twig Xdebug module on Windows 7.
I have already set up NetBeans so I can debug PHP code in Drupal 9. They are ...
1
vote
2
answers
266
views
How can I log a stack trace when I throw an exception? Is the logger PSR-3 compatible?
I'm trying to log a stacktrace when I throw an exception as suggested here.
I tried this:
catch (\Exception $e) {
\Drupal::logger('mymodule')->error($e->getMessage(), [ 'exception' => $...
1
vote
1
answer
46
views
Search is very slow for certain roles
I'm a bit lost here. I have a strange problem and don't know where to begin. I use the core search function on a website I build. When I am logged in as administrator this search function is working ...
1
vote
1
answer
95
views
How to find module that is updating my node after insert
When trying to create a new book i get the following message:
Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '53' for key 'PRIMARY': ...
0
votes
2
answers
2k
views
Enable error logging from settings.php
I am facing a The website encountered an unexpected error. error while setting up the site.
Most of the documentation I found online suggest to enable logging in the setting.php file.
I added this ...
-1
votes
1
answer
842
views
How do I debug Drupal\Component\PhpStorage\FileStorage::createDirectory()?
On my site, I am getting this warning.
Alert: User warning: mkdir(): Permission Denied in Drupal\Component\PhpStorage\FileStorage->createDirectory() (line 123 of core/lib/Drupal/Component/...
0
votes
1
answer
39
views
Devel Generate keeps generating files after uninstalling it
Some time ago I removed Devel from my site because it is in production now. However, when I look at the Content list I still see files being generated, like generateImage_J4d7CV.png and nq3cv2oMx9.txt
...
1
vote
1
answer
391
views
How do I get the un-truncated error message from dblog?
The "Recent log messages" is very handy to track down errors on sites. While this works great for errors in PHP code, it is often unhelpful for errors in Twig code. E.g. I've this error ...
0
votes
1
answer
175
views
Disable theme debugging html comments in particular view?
we are running commerce site, still tweaking some bits, so we have still twig debug set to true, but site is already online.. we have XML feed for exporting commerce products to couple of price ...
-1
votes
1
answer
48
views
Webform 6.1.0 help text not showing
I updated my webform Module from 5.3.0 to 6.1.0,
I have one the Following Error:
the help text isn't displaying its content on any form on my site (Example of help icon in the shared image)
It should ...
0
votes
1
answer
460
views
Webform 5.3 to 6.1.0 , Error : Call to undefined method Drupal\webform\Routing\WebformUncacheableResponse::addCacheableDependency() [closed]
I updated the webform module from 5.3.0 to the latest version (6.1.0) and then when I click submit on one of my forms, I receive this ERROR:
Error: Call to undefined method Drupal\webform\Routing\...
0
votes
1
answer
750
views
How can I debug a Twig error that occurs after migrating from Drupal 8.9 to Drupal 9+
I am trying migrate my Drupal 8.9 site to Drupal 9+ and I am stuck with an error its cause I am not able to hunt down. On almost every page I get the following PHP exception:
Twig\Error\RuntimeError: ...
3
votes
1
answer
140
views
Details wanted for "Mismatched entity and/or field definitions" message on custom field
I have developed a custom Drupal field.
All works fine. We are already using the field in production for a year. But the status report for exactly this field says:
Mismatched entity and/or field ...
0
votes
0
answers
240
views
How to find the cause of "Uncaught PHP Exception"
When I go to any page, the following error appears in the log:
[proxy_fcgi:error] [pid 20333] [client 172.18.0.6:52608] AH01071: Got error 'PHP message:
Uncaught PHP Exception Symfony\\Component\\...
0
votes
1
answer
212
views
How do I debug overridden twig templates?
How do I debug the template overrides. The debugger stops on page.html.twig but doesn't stop on sub templates such as
web/themes/custom/localtheme/templates/field--paragraph--field-pbcrossfade-image--...
-1
votes
1
answer
248
views
After upgrade to Drupal 9.2: Call to undefined function escapeshellcmd(). Why?
When I want to submit a form (webform module) I get get the followng error:
Call to undefined function Drupal\Core\Mail\Plugin\Mail\escapeshellcmd() in Drupal\Core\Mail\Plugin\Mail\PhpMail::...
0
votes
0
answers
26
views
Permissions suddenly changed
I've inherited a drupal 7.6 site with a broken css (styles were not loading). Here's what I've done so far:
-set sites/default/files, tmp and cache folder to 777.
-flushed all caches
When this didn't ...
-2
votes
1
answer
749
views
The website encountered an unexpected error. Please try again later. unable to debug
I have just moved a Drupal 7 site to a new server. The website loads ok but if I log in as an admin person and click on any of the admin menu options I get the error
The website encountered an ...
1
vote
2
answers
41
views
Strange Page not Found, Permissions, Clear cache
On my D7.80 I have developed a custom module:
function wrong_answer_menu() {
dd('it entered in hook menu');
$items['wrong-answer/%id'] = array(
'title' => t('Wrong Answer Dashboard'),
...
1
vote
1
answer
1k
views
Attempting to merge in an array of items into Twig classes
I have a Twig template where I'd like to merge in an array of items as classes. So far I have this code:
{% set classes = [
'media',
'media--type-' ~ media.bundle()|clean_class,
not media....
5
votes
1
answer
725
views
How to I trigger Xdebug 3.x with Drush in PHPStorm
Has anyone has success with getting CLI debugging (drush) working with Xdebug 3.x?
There are several obsolete posts here... but all obsolete with the new version of Xdebug.
Expected behavior
After ...
0
votes
0
answers
139
views
How can I print debug info in custom module?
I need to edit parts of a custom module that I didn't make, and I don't really have much experience editing/coding custom modules. How do I print debug info in functions in a custom module?
In the ...
1
vote
0
answers
217
views
Drupal + XDebug + VSCode = can't break on PHP notice or warning
Using Drupal (8.9), PHP (7.2.34) with xdebug, and VSCode (1.50.1) with PHP Debug (1.13.0), the debugger will no longer break on PHP notices and warnings, even if those option checkboxes are set.
The ...
1
vote
2
answers
279
views
Debugging node/route access
I want to set a breakpoint in xdebug to debug an interesting issue the site is having regarding user access to certain nodes. My question is where do I do that in D8? Where, specifically, is the D8 ...
0
votes
1
answer
1k
views
Debugging Ajax Callback
Goal: Print/dump $formState values to debug
I am altering a form and the functionality works:
$form['elements']['location']['deparment']['#ajax'] = [
'callback' => 'myAjaxCallback',
'event' =&...
1
vote
1
answer
655
views
twig dump() creates WSOD error
this is my first Drupal installation (I'm a symfony dev) and I've spent several hours trying to get dump() working. However it just causes a WSOD.
Maybe related: I'm unable to install kint, there's ...
3
votes
1
answer
788
views
Debug PHP code with XDebug and VS Code [closed]
For development I use a local Drupal 7 installation on Xampp under Windows 10. I use Visual Studio Code as IDE and want to debug my PHP code with it. I tried to set that up but can not quite get it ...
0
votes
1
answer
316
views
The "Modules" page doesn't load
I am running a setup on Ubuntu and WSL (Windows Subsystem for Linux) with Nginx and PHP7.4.
Drupal 8 and Drupal 9 fresh installations load every page with no problem, except the page on /admin/...
0
votes
0
answers
147
views
how to print node object in drupal 8 [duplicate]
in drupal 7 we could use kpr() from devel module or php print_r() and var_dump() functions to print $node object in node.tpl file or hook preprocess node in purpose of debugging and finding a field or ...
-3
votes
2
answers
1k
views
How can I prevent memory size exhaustion when dumping variables in Twig? [duplicate]
hello everyone i have a problem with kint , in my twig page i want to listing all variables contains int 'content' variable to make some logic on it , but the page can't loaded because the big pip ...
4
votes
1
answer
626
views
How to attach xdebug to drush in docker
How can I "attach" xdebug to drush in a docker container?
By that I mean, how can I have xdebug show me a history of an import script? And to look at the single variables that are defined and ...
1
vote
0
answers
449
views
Render HTML in Drupal 8 error messages
I'm working with Twig templates, and often see messages like this in the browser when I make a mistake:
The website encountered an unexpected error. Please try again later.</br></br><...
1
vote
0
answers
486
views
PHP Fatal error: Cannot redeclare twig_without() [closed]
Getting the below error after I tried to install new modules to D8.
[error] 32411#32411: *31 FastCGI sent in stderr: "PHP message: PHP
Fatal error: Cannot redeclare twig_without() (previously ...
3
votes
1
answer
156
views
Difference between $bundle and bundle()
Background information: I'm trying to manipulate the available options of a list type text field, depending on the host bundle:
function wtbase_options_list_alter(array &$options, array $context) ...
1
vote
1
answer
202
views
Why can't I debug twig templates with intellij idea?
I can't get intellij idea to break on twig files. It is breaking on theme and module files fine. This means that xdebug must be setup correctly. I don't believe that it is caching as I've deleted the ...
4
votes
0
answers
402
views
Does the structure of the module's src folder matter? [closed]
I've read about the Basic Structure guide to building a Drupal 8 module. It's great that it outlines the basic files needed to get a module up and running.
Where it falls short is the contents of the ...
0
votes
2
answers
102
views
How to debug why some content is not migrated from D7 to D8?
I am using migrate_plus to migrate from D7 to D8 and so far it has been a fairly smooth process.
I have a particular content type that has 10 nodes in D7 but will only migrate one of them to D8.
...
0
votes
0
answers
122
views
Is there a dd() like variable printer that can be used inside a preprocess?
Many times when I start a hook_preprocess_hook, I start by printing the $vars object. I can do this by dpm()'ing, dsm()'ing, kint()'ing etc. The problem is that all of these functions print $vars in ...
0
votes
1
answer
502
views
Extending a base template file such as field.html.twig renders no results?
So I have a custom content entity that has the typical attributes. Name, Author, Creation Date, ect. In the 'view' tab of this content entity, it displays said name, author, ect.
When I hover over ...
0
votes
0
answers
1k
views
Why is my custom twig template not being selected by Drupal?
So I have a custom module that has boilerplate template code inside it. No problem there. So I following the Drupal Docs which says to create a service.yml file and turn debug on and caches off. Done. ...
0
votes
1
answer
1k
views
How do I debug with Xdebug in Visual Studio Code? [closed]
When I try to debug Drupal 8 (8.6.11) using Xdebug in VS Code (I'm on Win 10 but I doubt it is relevant in this case) I get the following error:
Exception has occurred. Dotenv\Exception\...
1
vote
1
answer
554
views
How do I debug incorrect favicon showing on the front page in a custom theme?
I'm working on a Drupal 8 site with a custom theme that I didn't code. The site is using the metatag: favicons module to control the favicons. The favicon seem to work correct on all except the home ...
0
votes
0
answers
260
views
AttributeArray fails to implode #allowed_tags
I started working on existing project and right from beginning, it displayed tons of alerts in specific pages.
This is what Drupal outputs:
Notice: Array to string conversion in Drupal\Core\Template\...