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.

Example:

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

<?php
declare(strict_types=1);

require_once './../framework_includes.inc.php';

$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.

Thanks

 

The software versions are:

PHPStorm version 2016.3.2

Zend Server version 9.1.1 with PHP 7.1.7 

2 comments

Please attach a screenshot illustrating this.

0

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.

0

Please sign in to leave a comment.