Errors are the oldest form of error handling in PHP dating all the way back to PHP 3. Trigger_error is still useful in certain very limited circumstances owing to the fact that, unlike exceptions, errors cannot be caught or if they don't stop the system then code continues on the line following trigger_error. Drupal primarily makes use of Exceptions and assertions, using errors only when necessary to cause an immediate halt of the system.


Exceptions are the preferred method of fault handling in Drupal. They should be used in all cases but two.


(Note - the code implementing these features is still under development and has not been merged into core. See

An assertion is a special type of error function that is used during the development of code. It has existed in PHP since version 4 and is being introduced to Drupal as of version 8 in order to help monitor interactions between core code and third party modules.

Faults: Assertions, Errors, and Exceptions

(API still in development)

Sooner or later problems occur in all computer programs. There are three problem groups in PHP

Locating template files

If you want to know which template is generating a particular markup element, you can use Twig's debug option.
Besides the name of the template files it also reveals its location.

You enable Twig debugging in sites/default/services.yml. Set the variable debug in the section twig.config to true.

After you have set debug to true, clear the caches.

How to use Xdebug and PhpStorm with VDD

How to use Xdebug and PhpStorm with VDD

VDD supports out of the box Xdebug working configuration. You can simply start you virtual environment, open your project with PhpStorm and start debugging.


To make your debugging more comfortable you should install Xdebug helper extension in your browser. I'll use Google Chrome in this example.


Subscribe with RSS Subscribe to RSS - debugging