-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Scoped PHAR xdebug issue #3577
Comments
Maybe this is because the PHAR was built in an environment with/without xDebug installed? May that be the difference? |
Could be the case, not sure in what environment @sebastianbergmann is creating the phars When I look at the scoped code that gets bundled into the scoped phar, I have no clue how this could ever fail, because all if ($determineUnusedAndDead) {
\xdebug_start_code_coverage(\XDEBUG_CC_UNUSED | \XDEBUG_CC_DEAD_CODE);
} else {
\xdebug_start_code_coverage();
} |
@theofidry ping |
Yes, I created those PHARs in an environment where Xdebug was not loaded. |
Urg this is annoying. I think that's pretty much the issue since the Reflector will think it's an internal function as it should. So I think there is two immediate solutions:
The long-term solution is to improve BetterReflection (which PHP-Scoper Reflector is using) in order to spot which function is effectively internal or not without having to load any code. |
@theofidry I think that would need Roave/BetterReflection#373 |
I have uploaded an updated scoped PHAR to Can you please check whether this solves your problem? Thanks! |
Yes now it works with code coverage as well. |
While it might work for xdebug now, the problem persists for pcov:
Or should that be a new issue? |
It's a different manifestation of the same underlying issue. And to fix that we need Roave/BetterReflection#373. |
@theofidry I wonder whether php-scoper really needs to know that a function or class is built-in (provided by an extension). What happens right now is that php-scoper sees a call to a function without seeing the declaration of that function. Would it not be better then to simply not change calls to units of code for which the declaration is not part of the code that is to prefixed? |
Is the issue specifically about internal/non-internal or just defined/not-defined? To check this: what happens if those functions are explicitly imported via |
The problem is it's hard to guess that. PHP-Scoper doesn't load all the code before scoping (and even if it were you may have some code not loaded under certain conditions) so it can't do any guess work there. IMO there is only two good ways to improve the approach here:
Meanwhile, isn't it possible to build the scoped PHAR with the latest supported PHP version and all the extensions PHPUnit interacts with? It is not ideal but at least will would reduce the number of issues caused by an extension functions being scoped incorrectly |
That may work for PCOV and Xdebug but I am not so sure about PHPDBG because that is not an extension but a different SAPI.
That makes no sense, sorry for the noise. |
I think relying on patchers is the only way to fix it in the meantime then :/ |
@theofidry Re: #3577 (comment) Correct me if I am wrong, but that "hotfix" does not help us as the Depending on how long we have to wait for Roave/BetterReflection#373, you may want to consider depending on https://github.com/JetBrains/phpstorm-stubs in php-scoper to fill the I briefly looked at patchers but am not sure how they could help us. |
Speaking of which, if you need to speed up merging Roave/BetterReflection#373, please do help in reviewing. I just noticed that it has been ready for weeks now :| |
Heads up: Roave/BetterReflection#373 is merged, and 3.3.0 of said package was released. |
Thanks! Will check it out in details once back from holidays :)
…On Sat 20 Apr 2019 at 17:24, Sebastian Bergmann ***@***.***> wrote:
Thank you, @kukulich <https://github.com/kukulich> and @Ocramius
<https://github.com/Ocramius>!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3577 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABHPVANKF4FZUDTCCFHJNULPRLHLTANCNFSM4HBOXUCA>
.
|
Just a small heads up: there is a lot of changes coming from BetterReflection and I'm doing some more work on both PHP-Scoper and Box. I can't give an ETA (I hope a couple of weeks) but I really hope the next version is going to help out a lot to move forward for this PR :) |
Thanks a lot, @theofidry, for all the work you do on PHP-Scoper! |
Please test with https://phar.phpunit.de/phpunit-scoped-8.2.0.phar which was built using the latest PHP-Scoper. |
|
It looks there is no |
It should be fixable with patchers although it's a PITA and would be nice to fix it upstream in phpstorm stubs |
Please test with https://phar.phpunit.de/phpunit-scoped-8.2.2.phar. It was built with the latest version of PHP-Scoper and should solve this problem. |
|
@sebastianbergmann can you confirm it was PHP-Scoper 0.12.1+? |
https://github.com/sebastianbergmann/phpunit/blob/8.2.2/tools/php-scoper was used to create the scoped PHAR for PHPUnit 8.2.2. |
Arg, ofc I'm such an idiot: private const MISSING_CLASSES = ['UV', '_HumbugBox2333ac9fbdb0\\Crypto\\Cipher', '_HumbugBox2333ac9fbdb0\\Crypto\\CipherException', '_HumbugBox2333ac9fbdb0\\Crypto\\Hash', '_HumbugBox2333ac9fbdb0\\Crypto\\HashException', '_HumbugBox2333ac9fbdb0\\Crypto\\MAC', '_HumbugBox2333ac9fbdb0\\Crypto\\MACException', '_HumbugBox2333ac9fbdb0\\Crypto\\HMAC', '_HumbugBox2333ac9fbdb0\\Crypto\\CMAC', '_HumbugBox2333ac9fbdb0\\Crypto\\KDF', '_HumbugBox2333ac9fbdb0\\Crypto\\KDFException', '_HumbugBox2333ac9fbdb0\\Crypto\\PBKDF2', '_HumbugBox2333ac9fbdb0\\Crypto\\PBKDF2Exception', '_HumbugBox2333ac9fbdb0\\Crypto\\Base64', '_HumbugBox2333ac9fbdb0\\Crypto\\Base64Exception', '_HumbugBox2333ac9fbdb0\\Crypto\\Rand', '_HumbugBox2333ac9fbdb0\\Crypto\\RandException', '_HumbugBox2333ac9fbdb0\\parallel\\Channel', '_HumbugBox2333ac9fbdb0\\parallel\\Channel\\Error', '_HumbugBox2333ac9fbdb0\\parallel\\Channel\\Error\\Closed', '_HumbugBox2333ac9fbdb0\\parallel\\Channel\\Error\\Existence', '_HumbugBox2333ac9fbdb0\\parallel\\Channel\\Error\\IllegalValue', '_HumbugBox2333ac9fbdb0\\parallel\\Error', '_HumbugBox2333ac9fbdb0\\parallel\\Events', '_HumbugBox2333ac9fbdb0\\parallel\\Events\\Error', '_HumbugBox2333ac9fbdb0\\parallel\\Events\\Error\\Existence', '_HumbugBox2333ac9fbdb0\\parallel\\Events\\Error\\Timeout', '_HumbugBox2333ac9fbdb0\\parallel\\Events\\Event', '_HumbugBox2333ac9fbdb0\\parallel\\Events\\Event\\Type', '_HumbugBox2333ac9fbdb0\\parallel\\Events\\Input', '_HumbugBox2333ac9fbdb0\\parallel\\Events\\Input\\Error', '_HumbugBox2333ac9fbdb0\\parallel\\Events\\Input\\Error\\Existence', '_HumbugBox2333ac9fbdb0\\parallel\\Events\\Input\\Error\\IllegalValue', '_HumbugBox2333ac9fbdb0\\parallel\\Future', '_HumbugBox2333ac9fbdb0\\parallel\\Future\\Error', '_HumbugBox2333ac9fbdb0\\parallel\\Future\\Error\\Cancelled', '_HumbugBox2333ac9fbdb0\\parallel\\Future\\Error\\Foreign', '_HumbugBox2333ac9fbdb0\\parallel\\Future\\Error\\Killed', '_HumbugBox2333ac9fbdb0\\parallel\\Runtime', '_HumbugBox2333ac9fbdb0\\parallel\\Runtime\\Bootstrap', '_HumbugBox2333ac9fbdb0\\parallel\\Runtime\\Error', '_HumbugBox2333ac9fbdb0\\parallel\\Runtime\\Error\\Bootstrap', '_HumbugBox2333ac9fbdb0\\parallel\\Runtime\\Error\\Closed', '_HumbugBox2333ac9fbdb0\\parallel\\Runtime\\Error\\IllegalFunction', '_HumbugBox2333ac9fbdb0\\parallel\\Runtime\\Error\\IllegalInstruction', '_HumbugBox2333ac9fbdb0\\parallel\\Runtime\\Error\\IllegalParameter', '_HumbugBox2333ac9fbdb0\\parallel\\Runtime\\Error\\IllegalReturn'];
private const MISSING_FUNCTIONS = ['sapi_windows_vt100_support', 'uv_unref', 'uv_last_error', 'uv_err_name', 'uv_strerror', 'uv_update_time', 'uv_ref', 'uv_run', 'uv_run_once', 'uv_loop_delete', 'uv_now', 'uv_tcp_bind', 'uv_tcp_bind6', 'uv_write', 'uv_write2', 'uv_tcp_nodelay', 'uv_accept', 'uv_shutdown', 'uv_close', 'uv_read_start', 'uv_read2_start', 'uv_read_stop', 'uv_ip4_addr', 'uv_ip6_addr', 'uv_listen', 'uv_tcp_connect', 'uv_tcp_connect6', 'uv_timer_init', 'uv_timer_start', 'uv_timer_stop', 'uv_timer_again', 'uv_timer_set_repeat', 'uv_timer_get_repeat', 'uv_idle_init', 'uv_idle_start', 'uv_idle_stop', 'uv_getaddrinfo', 'uv_tcp_init', 'uv_default_loop', 'uv_loop_new', 'uv_udp_init', 'uv_udp_bind', 'uv_udp_bind6', 'uv_udp_recv_start', 'uv_udp_recv_stop', 'uv_udp_set_membership', 'uv_udp_set_multicast_loop', 'uv_udp_set_multicast_ttl', 'uv_udp_set_broadcast', 'uv_udp_send', 'uv_udp_send6', 'uv_is_active', 'uv_is_readable', 'uv_is_writable', 'uv_walk', 'uv_guess_handle', 'uv_handle_type', 'uv_pipe_init', 'uv_pipe_open', 'uv_pipe_bind', 'uv_pipe_connect', 'uv_pipe_pending_instances', 'uv_ares_init_options', 'ares_gethostbyname', 'uv_loadavg', 'uv_uptime', 'uv_get_free_memory', 'uv_get_total_memory', 'uv_hrtime', 'uv_exepath', 'uv_cpu_info', 'uv_interface_addresses', 'uv_stdio_new', 'uv_spawn', 'uv_process_kill', 'uv_kill', 'uv_chdir', 'uv_rwlock_init', 'uv_rwlock_rdlock', 'uv_rwlock_tryrdlock', 'uv_rwlock_rdunlock', 'uv_rwlock_wrlock', 'uv_rwlock_trywrlock', 'uv_rwlock_wrunlock', 'uv_mutex_init', 'uv_mutex_lock', 'uv_mutex_trylock', 'uv_sem_init', 'uv_sem_post', 'uv_sem_wait', 'uv_sem_trywait', 'uv_prepare_init', 'uv_prepare_start', 'uv_prepare_stop', 'uv_check_init', 'uv_check_start', 'uv_check_stop', 'uv_async_init', 'uv_async_send', 'uv_queue_work', 'uv_fs_open', 'uv_fs_read', 'uv_fs_close', 'uv_fs_write', 'uv_fs_fsync', 'uv_fs_fdatasync', 'uv_fs_ftruncate', 'uv_fs_mkdir', 'uv_fs_rmdir', 'uv_fs_unlink', 'uv_fs_rename', 'uv_fs_utime', 'uv_fs_futime', 'uv_fs_chmod', 'uv_fs_fchmod', 'uv_fs_chown', 'uv_fs_fchown', 'uv_fs_link', 'uv_fs_symlink', 'uv_fs_readlink', 'uv_fs_stat', 'uv_fs_lstat', 'uv_fs_fstat', 'uv_fs_readdir', 'uv_fs_sendfile', 'uv_fs_event_init', 'uv_tty_init', 'uv_tty_get_winsize', 'uv_tty_set_mode', 'uv_tty_reset_mode', 'uv_tcp_getsockname', 'uv_tcp_getpeername', 'uv_udp_getsockname', 'uv_resident_set_memory', 'uv_ip4_name', 'uv_ip6_name', 'uv_poll_init', 'uv_poll_start', 'uv_poll_stop', 'uv_fs_poll_init', 'uv_fs_poll_start', 'uv_fs_poll_stop', 'uv_stop', 'uv_signal_stop', '_HumbugBox2333ac9fbdb0\\parallel\\bootstrap', '_HumbugBox2333ac9fbdb0\\parallel\\run', '_HumbugBox2333ac9fbdb0\\pcov\\collect', '_HumbugBox2333ac9fbdb0\\pcov\\start', '_HumbugBox2333ac9fbdb0\\pcov\\stop', '_HumbugBox2333ac9fbdb0\\pcov\\clear', '_HumbugBox2333ac9fbdb0\\pcov\\waiting', '_HumbugBox2333ac9fbdb0\\pcov\\memory'];
private const MISSING_CONSTANTS = ['STDIN', 'STDOUT', 'STDERR', '_HumbugBox2333ac9fbdb0\\pcov\\all', '_HumbugBox2333ac9fbdb0\\pcov\\inclusive', '_HumbugBox2333ac9fbdb0\\pcov\\exclusive']; Will fix that ASAP |
@theofidry I think somebody should tell you this: you are not an idiot and your work is very much appreciated :-) |
Thanks :) Will try to fix that issue today, if I cannot it will have to way Monday/Tuesday |
Please test with https://phar.phpunit.de/phpunit-scoped-8.2.4.phar which was built using php-scoper 0.12.4. |
\o/ |
I think this has progressed enough to stop offering non-scoped PHARs of PHPUnit starting with PHPUnit 8.3. Thank you to everyone involved in making this happen! |
When running the
8.0.6
scoped phar on a test suite with code coverage I get this error.When I checkout the latest
8.0
branch and create the PHAR myself it works just fine.Is it just me or does someone get the same error with code coverage
The text was updated successfully, but these errors were encountered: