Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable strict interpretation of scalar type declarations in process isolation code templates #3785

Closed
sebastianbergmann opened this issue Aug 4, 2019 · 4 comments
Labels
feature/process-isolation Issues related to running tests in separate PHP processes type/refactoring A refactoring that should be applied to make the code easier to understand and maintain

Comments

@sebastianbergmann
Copy link
Owner

69e61bb enabled the strict interpretation of scalar type declarations in the code templates used by process isolation. This caused a problem with PHPDBG detailed in #3772.

We need to investigate which statement(s) in these templates cause a problem when scalar type declarations are interpreted strictly. After fixing {this|these} issue(s) we can then enable the strict interpretation of scalar type declarations in the code templates again.

@sebastianbergmann sebastianbergmann added the type/enhancement A new idea that should be implemented label Aug 4, 2019
@sanmai
Copy link
Contributor

sanmai commented Aug 16, 2019

It appears adding a strict types declaration makes PHPDBG drop all what it's doing and stop. E.g. consider this example without strict types:

$ cat example.php 
<?php
echo "OK!\n";
$ cat example.php | phpdbg -qrrs=
OK!

And now the same example with strict types:

$ cat example2.php 
<?php
declare(strict_types=1);
echo "OK!\n";
$ cat example2.php | phpdbg -qrrs=
[Nothing to execute!]

Might this be a PHP bug?

$ phpdbg --version
phpdbg 0.5.0 (built: Aug  7 2019 09:50:45)
PHP 7.3.8-1, Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.8-1, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.7.0RC2, Copyright (c) 2002-2019, by Derick Rethans

@Danack
Copy link
Contributor

Danack commented Aug 16, 2019

Might this be a PHP bug?

Yes. Please can you open an issue on https://bugs.php.net/ ?

Possibly after disabling xdebug while re-running the test, just to make sure it's a problem in just PHP, rather than an artefact of running it with Xdebug also loaded.

@sanmai
Copy link
Contributor

sanmai commented Aug 17, 2019

Done.

https://bugs.php.net/bug.php?id=78424

Xdebug is irrelevant here, but I verified that the problem remains even if it isn't used.

@DanielRuf
Copy link
Contributor

Interestingly I always get the [Nothing to execute!] result. For both examples.

@sebastianbergmann sebastianbergmann added feature/process-isolation Issues related to running tests in separate PHP processes type/refactoring A refactoring that should be applied to make the code easier to understand and maintain and removed type/enhancement A new idea that should be implemented labels Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/process-isolation Issues related to running tests in separate PHP processes type/refactoring A refactoring that should be applied to make the code easier to understand and maintain
Projects
None yet
Development

No branches or pull requests

4 participants