View Issue Details

IDProjectCategoryView StatusLast Update
0002145XdebugUncategorizedpublic2023-02-02 01:14
ReporterMaxArhipov Assigned Toderick  
PriorityhighSeverityblockReproducibilityalways
Status assignedResolutionopen 
Product Version3.2.0 
Summary0002145: Xdebug 3.2.0 crash PHP on Windows if xdebug.mode = off
Description

Xdebug 3.2.0 crash PHP on Windows if xdebug.mode = off
I tried with PHP 8.0.x on Windows 10 Pro 22H2

Steps To Reproduce

Install Xdebug 3.2.0 with any PHP version you like (tried with 8.0.x) on Windows.
In php.ini, set xdebug.mode to "off".
Running phpinfo() works fine, but running any script causes PHP to crash (tried with Adminer).

Additional Information

Minimal Xdebug configuration in php.ini to reproduce:

[XDebug]
zend_extension = path\to\php_xdebug-3.2.0-8.0-vs16-x86_64.dll
xdebug.mode = off

TagsNo tags attached.
Operating SystemWindows 10 Pro 22H2
PHP Version8.0.20-8.0.29

Activities

derick

2022-12-12 09:42

administrator   ~0006475

Hi,

I can obviously not reproduce this on Linux — but can you let me know more about your setup? Using Apache, or IIS, or something else?

Can you also reproduce this with the built-in webserver of PHP?

You can run that like the following (although you might need to set paths):

php -n -d xdebug.mode=debug -d zend_extension=xdebug -S localhost:9242

Then request a file in the directory where you called this from, by going to http://localhost:9242/filename.php in the browser.

cheers,
Derick

MaxArhipov

2022-12-12 22:51

reporter   ~0006480

With command php -n -d xdebug.mode=debug -d zend_extension=xdebug -S localhost:9242 it works. But problem with Apache (mod_php) and mode OFF (NOT DEVELOP).

Test config: PHP 8.2.0, PHP 8.1.12, PHP 8.0.25 (minimal config) + Xdebug 3.2.0+ Apache 2.4.54 (minimal config) + Windows 10 Pro 22H2
Crash on all PHP versions ( 8.2.0, 8.1.12, 8.0.25) with xdebug.mode=off on Xdebug 3.2.0
File index.php if it contains only phpinfo() it works fine, but running Adminer (mysql admin script) causes PHP to crash.

PHP.ini (this is the entire text of the file):

[PHP]

extension_dir = "C:/Users/User/PHP/ext"
extension = mbstring
extension = mysqli
zend_extension = xdebug

[xdebug]

xdebug.mode = off

MaxArhipov

2022-12-13 00:27

reporter   ~0006481

The main Apache process remains in the process list, but the child process crashes with every request and constant automatic restart. The Apache child process in Windows is the main PHP workflow, because only one Apache child process is allowed in Windows with mpm_winnt_module.

When I remove: "zend_extension = xdebug"
or when I change: "debug.mode = off"
then everything works fine.

Xdebug 3.1.6 does not have such problems.

MaxArhipov

2023-02-02 01:04

reporter   ~0006511

I investigated the problem deeper, step-by-step executed the code of the popular Adminer script, and I found out that PHP+XDebug crashes from the following line of code:
<?php
parent::set_charset('utf8');

The problem occurs in Windows when using Apache with PHP+Xdebug, provided that xdebug.mode = off

In a normal situation PHP should not crash and should output the following error:
Fatal error: Uncaught Error: Cannot access "parent" when no class scope is active in C:\XDebugTest\home\index.php:2 Stack trace: #0 {main} thrown in C:\XDebugTest\home\index.php on line 2

Since the problem is still not solved, I assumed that it is difficult for you to reproduce this on windows yourself. I have prepared a test bench for you: https://files.ospanel.io/XDebugTest.zip , unpack the XDebugTest folder to the root of C: and run C:\XDebugTest\Start_Apache_Server.bat

If it does not start, then you need to install libraries from Microsoft:
https://aka.ms/vs/17/release/VC_redist.x64.exe
https://aka.ms/vs/17/release/VC_redist.x86.exe

After the server is successfully started, run http://127.0.8.1/ and you will see that the Apache child process (mod_php) constantly crashes with every http request. If you disable the Xdebug extension in the PHP config and restart the server, then everything works fine.

Windows event log:
application: httpd.exe , version: 2.4.54.0, timestamp: 0x63623406
module: unknown, version: 0.0.0.0, timestamp: 0x00000000
Exception code: 0xc0000005
Error offset: 0x0000000000000000
ID of the failed process: 0x6cec
Launch time of the failed application: 0x01d9369a0bdc5e7a
The path of the failed application: C:\XDebugTest\Apache\bin\httpd.exe
The path of the failed module: unknown

MaxArhipov

2023-02-02 01:14

reporter   ~0006512

PHP + Xdebug 3.2.0 also crashes from the following line of code:

<?php
if (extension_loaded("xdebug")) {
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);

in php.ini:

[xdebug]
zend_extension = xdebug
xdebug.mode = off

Issue History

Date Modified Username Field Change
2022-12-11 21:11 MaxArhipov New Issue
2022-12-12 09:42 derick Assigned To => derick
2022-12-12 09:42 derick Status new => feedback
2022-12-12 09:42 derick Note Added: 0006475
2022-12-12 22:51 MaxArhipov Note Added: 0006480
2022-12-12 22:51 MaxArhipov Status feedback => assigned
2022-12-13 00:27 MaxArhipov Note Added: 0006481
2023-02-02 01:04 MaxArhipov Note Added: 0006511
2023-02-02 01:14 MaxArhipov Note Added: 0006512