Page 1 of 1

Debugging on MacOS, declare strict and non-ascii chars

Posted: Tue Jan 02, 2018 9:12 am
by larsribe
Hi Zend
System setup: MacOS High Sierra running Zend Server 9.1.2.

If I make a file containing non-ASCII chars, e.g.

TestClass.php:
<?php
declare(strict_types=1);

class TestClass
{
public function test()
{
echo 'ÆØÅ'; //Danish characters
}
}

Then I can call the class from the web server without problems, I can run a unit test without a problem, but if I debug the class through the web server or through unit testing, I get an error:

TestClass.php line 2: strict_types declaration must be the very first statement in the script

I have tried with and without an autoloader so that seems not like being the problem. I have also tried to save the file as UTF-8 or ISO-8859-1 without any difference, so it is apparently not the UTF8 BOM.

This occurs both with Zend Studio and PHP Storm, so the problem must be the debugger.

Re: Debugging on MacOS, declare strict and non-ascii chars

Posted: Sun Jan 07, 2018 2:16 pm
by zvika
Hello Lars,
thank you for bringing this to our attention.
Please report the issue through the support portal,
as suggested on your post http://forums.zend.com/viewtopic.php?f=8&t=133893
Thank you.

Re: Debugging on MacOS, declare strict and non-ascii chars

Posted: Sun Jan 07, 2018 2:28 pm
by zvika
Hi Lars,
Can you verify that your PHPUnit is above 6.4.1?
I found an issue which was fixed by Sebastian Bergmann here:
https://github.com/sebastianbergmann/ph ... ssues/2791

If upgrading PHPUnit doesn't help, please proceed as recommended earlier by opening a support case so we can work on the issue in the official channels.