Problem debugging when using PHP 7.1 and strict_types

When the debugger reach a file that has "strict_types" enabled, it throw an fatal error (look below for example). While if you run same code in the browser it execute as expected with no fatal errors thrown.


Fatal error: strict_types declaration must be the very first statement in the script in [path] on line 2


require_once './../';

$controller = new \Kaizen\Controller();
$controller->launch('home', 'login', 'control');


If the "strict_types" is removed, the debugger run as normal until it hit the next file where it is set. 

Not sure where the error lies, if it is on PHPStorm side or Zend Server, but if anyone have an idea on how this can be solved I would be grateful.



The software versions are:

PHPStorm version 2016.3.2

Zend Server version 9.1.1 with PHP 7.1.7 


Please attach a screenshot illustrating this.


Been doing some more tests to try and get it working and it seems this issue only happen when the debug session is initiated from the browser (using Zend Z-Ray). If I initiate the debug from Phpstorm, it does not happen.

The last is a possible work around, but kind of messy since the mapping has to be set manually each time.

Note. If I keep the "strict_types" setting in the index page, it throws an "Debug session was finished without being paused" and the error does not show in the console, only in the browser. If I remove the "strict_types" setting from the index page, it throw the error on the first file that contain it.


Please sign in to leave a comment.