View Issue Details

IDProjectCategoryView StatusLast Update
0001254XdebugUncategorizedpublic2021-04-14 16:10
Reportertrivivium Assigned Toderick  
PriorityhighSeveritycrashReproducibilityalways
Status closedResolutionunable to reproduce 
PlatformLinuxOSUbuntuOS Version12.04.03 LTS
Product Version2.4.0rc3 
Summary0001254: Segmentation fault with PHP 7, xdebug and native spl_autoload()
Description

When using the native spl_autoload() implementation with xdebug a segmentation fault is produced.

This happens on a vagrant environment (both Virtual-box and Hyper-V as provider) with Ubuntu 12.04.3 installed. I have compiled PHP-7.0 from source (github repository). Then I have installed xdebug by using the instructions from the documentation on installing from source (used: http://xdebug.org/files/xdebug-2.4.0rc3.tgz).

Steps To Reproduce

I have included a small zip-compressed folder with the minimum required code to reproduce the segmentation fault.

My observations are that the segmentation fault happens with (what seems to me) some very weird reasons. In the file library/request/Factory.php I have left a comment before the code, which triggers the bug in the library/response/Factory::build() method.

I have used the command: 'php -d xdebug.auto_trace=ON /index.php' to trace the segmentation fault and have gotton some inconsistent results. It appears the fault happens at different places when a object is instantiated directly in the parameter list. The instantiation must be the 2+ argument.

Additional Information

This has been tested on 3 different computers with the same end result.

TagsPHP7
Attached Files
Operating SystemUbuntu 12.04.03 LTS
PHP Version7.0.0-7.0.4

Activities

trivivium

2016-01-16 03:20

reporter   ~0003421

It should also be said that if xdebug is disabled (zend_extension line removed from php.ini) the segmentation fault disappears.

derick

2016-02-09 18:48

administrator   ~0003472

When I run your code, I get:

derick@whisky:/tmp/xdebug-segmentation-fault-reproduce $ php -dxdebug.collect_params=4 -dxdebug.auto_trace=ON index.php

Fatal error: Uncaught LogicException: Class request\Factory could not be loaded in /tmp/xdebug-segmentation-fault-reproduce/index.php on line 5

LogicException: Class request\Factory could not be loaded in /tmp/xdebug-segmentation-fault-reproduce/index.php on line 5

Call Stack:
0.0002 0 1. {main}() /tmp/xdebug-segmentation-fault-reproduce/index.php:0
0.0004 0 2. spl_autoload('request\Factory') /tmp/xdebug-segmentation-fault-reproduce/index.php:5

Is that what you expect as output? If I look at strace, it wants to look up things by the lower case filename "factory.php" only, which of course does not exist (only Factory.php does).

trivivium

2016-02-10 16:12

reporter   ~0003476

Even though the file name is converted into lowercase and every file is renamed to all lowercase the issue persist.

If I run the same command as you the output is:

TRACE START [2016-02-10 15:58:14]
0.0002 349840 -> {main}() /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/index.php:0
0.0014 351112 -> require(/vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/autoload.php) /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/index.php:3
0.0014 351112 -> get_include_path() /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/autoload.php:7
0.0014 351208 -> set_include_path('.::/vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/library/') /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/autoload.php:7
0.0014 351624 -> spl_autoload_register() /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/autoload.php:8
0.0014 350992 -> spl_autoload('request\Factory') /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/index.php:5
0.0036 358320 -> {main}() /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/index.php:0
0.0036 357784 -> request\Factory::build($attributes = ???) /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/index.php:5
0.0036 358216 -> filter_input(5, 'REQUEST_URI', 518) /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/library/request/factory.php:23
0.0036 358216 -> array_merge(array (...), array ()) /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/library/request/factory.php:26
0.0036 358536 -> strpos('/', '?') /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/library/request/factory.php:33
0.0037 358536 -> spl_autoload('storage\Collection') /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/library/request/factory.php:38
0.0057 360472 -> {main}() /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/library/request/factory.php:0
0.0057 360000 -> storage\Collection->construct($items = ???) /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/library/request/factory.php:38
0.0057 360040 -> storage\Collection->
construct($items = ???) /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/library/request/factory.php:39
0.0057 360080 -> storage\Collection->__construct($items = ???) /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/library/request/factory.php:40
0.0057 360080 -> spl_autoload('request\Request') /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/library/request/factory.php:42
0.0071 362032 -> {main}() /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/library/request/factory.php:0
0.0072 361536 -> request\Request->__construct($attributes = array (...) /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/library/request/factory.php:42
0.0072 360664 -> spl_autoload('response\Factory') /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/index.php:6
0.0091 363304 -> {main}() /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/index.php:0
0.0091 363136 -> response\Factory::build($attributes = array ('code' => 200, 'content' => ''), $headers = ???) /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/index.php:7
0.0091 363192 -> spl_autoload('response\Response') /vagrant/src/httpdocs/xdebug-segmentation-fault-reproduce/library/response/factory.php:16

(Line at: 0.0036 and 0.0072 has been shortened)

I have now tried renaming all files and classes defined lowercase with no success. The issue
disappears if you disable xdebug though.

Hope this can help. I didn't know about class/file names being lowercased by the SPL autoloader, but I have
never had issues before installing xdebug.

derick

2021-03-17 09:39

administrator   ~0005771

Is this issue still relevant to you?

derick

2021-04-14 16:10

administrator   ~0005845

Closing this, as it is missing requested feedback.

Issue History

Date Modified Username Field Change
2016-01-16 03:16 trivivium New Issue
2016-01-16 03:17 trivivium File Added: xdebug-segmentation-fault-reproduce.zip
2016-01-16 03:17 trivivium Tag Attached: PHP7
2016-01-16 03:20 trivivium Note Added: 0003421
2016-02-09 18:48 derick Note Added: 0003472
2016-02-09 18:48 derick Assigned To => derick
2016-02-09 18:48 derick Status new => feedback
2016-02-10 16:12 trivivium Note Added: 0003476
2016-02-10 16:12 trivivium Status feedback => assigned
2016-07-31 12:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 12:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)
2016-12-04 15:16 derick Status assigned => acknowledged
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized
2021-03-17 09:39 derick Status acknowledged => feedback
2021-03-17 09:39 derick Note Added: 0005771
2021-04-14 16:10 derick Status feedback => closed
2021-04-14 16:10 derick Resolution open => unable to reproduce
2021-04-14 16:10 derick Note Added: 0005845