View Issue Details

IDProjectCategoryView StatusLast Update
0001496XdebugStep Debuggingpublic2017-11-23 18:30
Reporterildar Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionno change required 
OSarchlinux 
Summary0001496: Server Error 500 related to throw new \Exception
Description

The script does not work on PHP Version 7.2.0RC6
and git xdebug

<code>
class XCLowOpensslCryptor
{
public function decryptString($in, $key, $fmt = null)
{//{{{
throw new \Exception(METHOD . ' - Not an openssl cipher');
}//}}}
}

try {
$low_cryptor = new XCLowOpensslCryptor();
$res = $low_cryptor->decryptString(1, 2);
} catch (Exception $e) {
}

echo 'Test Passed';
die();

</code>

The fix is
-zend_extension=/opt/phpfarm/inst/php-7.2.0RC6/lib/php/extensions/xdebug2xrc6.so
+;zend_extension=/opt/phpfarm/inst/php-7.2.0RC6/lib/php/extensions/xdebug2xrc6.so

in
/opt/phpfarm/inst/php-7.2.0RC6/lib/php.ini

Steps To Reproduce

compiled on
aim-server[~/tmp/xdebug]$ git log -1
commit e0652e9fb0e945677d01396616688826c2037733 (HEAD -> master, origin/master, origin/HEAD)
Merge: e4f9c54e 31f33c5c
Author: Derick Rethans github@derickrethans.nl
Date: Wed Nov 22 23:59:27 2017 +0000

Merged pull request #383

aim-server[~/tmp/xdebug]$ git branch

  • master

via

/opt/phpfarm/inst/php-7.2.0RC6/bin/phpize
./configure --enable-xdebug --with-php-config=/opt/phpfarm/inst/php-7.2.0RC6/bin/php-config
make
cpi modules/xdebug.so /opt/phpfarm/inst/php-7.2.0RC6/lib/php/extensions/xdebug2x.so
sudo -E vim /opt/phpfarm/inst/php-7.2.0RC6/lib/php.ini
zend_extension=/opt/phpfarm/inst/php-7.2.0RC6/lib/php/extensions/xdebug2x.so

Additional Information

If I remove the line
throw new \Exception(METHOD . ' - Not an openssl cipher');
the 500 error will be disappeared.

/var/log/httpd/error_log shows
[Thu Nov 23 10:16:30.475332 2017] [fastcgi:error] [pid 16035:tid 139965534172928] (104)Connection reset by peer: [client 192.168.69.3:53800] FastCGI: comm with server "/srv/http/bin/php-fastcgi5329" aborted: read failed
[Thu Nov 23 10:16:30.475481 2017] [fastcgi:error] [pid 16035:tid 139965534172928] [client 192.168.69.3:53800] FastCGI: incomplete headers (0 bytes) received from server "/srv/http/bin/php-fastcgi5329"

TagsNo tags attached.
Operating SystemLinux aim-server.crtdev.local 4.13.12-1-ARCH #1 SMP PREEMPT Wed Nov 8 11:54:06 CET 2017 x86_64 GNU/Linux
PHP Version7.2-dev

Activities

ildar

2017-11-23 06:33

reporter   ~0004481

The fix is
-zend_extension=/opt/phpfarm/inst/php-7.2.0RC6/lib/php/extensions/xdebug2x.so
+;zend_extension=/opt/phpfarm/inst/php-7.2.0RC6/lib/php/extensions/xdebug2x.so

derick

2017-11-23 10:27

administrator   ~0004482

I'm not having success reproducing this.

Can you reproduce this on the command line?
Does this happen always? Or does a debugging session need to be active?

ildar

2017-11-23 11:28

reporter   ~0004483

It happens always.

aim-server[~/public_html]$ /opt/phpfarm/inst/php-7.2.0RC6/bin/php p.php
zsh: segmentation fault (core dumped) /opt/phpfarm/inst/php-7.2.0RC6/bin/php p.php
aim-server[~/public_html]$ cat p.php
<?php

class XCLowOpensslCryptor
{
public function decryptString($in, $key, $fmt = null)
{//{{{
throw new \Exception(METHOD . ' - Not an openssl cipher');
}//}}}
}

try {
$low_cryptor = new XCLowOpensslCryptor();
$res = $low_cryptor->decryptString(1, 2);
} catch (Exception $e) {
}

echo 'Test Passed';
die();
aim-server[~/public_html]$

ildar

2017-11-23 11:29

reporter   ~0004484

It works without exception

aim-server[~/public_html]$ /opt/phpfarm/inst/php-7.2.0RC6/bin/php p.php
Test Passed% aim-server[~/public_html]$ cat p.php
<?php

class XCLowOpensslCryptor
{
public function decryptString($in, $key, $fmt = null)
{//{{{
}//}}}
}

try {
$low_cryptor = new XCLowOpensslCryptor();
$res = $low_cryptor->decryptString(1, 2);
} catch (Exception $e) {
}

echo 'Test Passed';
die();

ildar

2017-11-23 11:45

reporter   ~0004485

Last edited: 2017-11-23 11:48

I have used
git bisect to find the first bad commit.
https://git-scm.com/book/en/v2/Git-Tools-Debugging-with-Git

It shows

aim-server[~/tmp/xdebug]$ git bisect bad
669a81c9ba59905b2177c4dde77899027a7a8953 is the first bad commit
commit 669a81c9ba59905b2177c4dde77899027a7a8953
Author: Derick Rethans github@derickrethans.nl
Date: Sat Nov 18 17:14:00 2017 +0000

Implemented issue #1323: Add setting to configure the formatting of filenames

:100644 100644 d278ac14c635c5b4d5c7acfd70edf2d0aed8ac96 da488fa6ae1e975fc768d375ed886261f8a126f1 M php_xdebug.h
:040000 040000 51444c54743c6d7d0f4d145a95e6a43cca1ebdc9 f1dccd4319f34bcc73cc9088d9b71c9e8b82d6f1 M tests
:100644 100644 11eb255edaddedad3f63b8a17f96b7475527f13e 27ee9fec95b1b935349775c490c701e7b3ae1380 M usefulstuff.c
:100644 100644 04b05896ecd090a74c1b4f729157817ca8e05444 0777d9313964dc6de3a12ca32c406f2484e22f39 M usefulstuff.h
:100644 100644 3041c7d9dbe30dbc446a7e2589f952f191b1a276 d87fb01e03cd883709863f9d74ec8e2c0aad7644 M xdebug.c
:100644 100644 3593414a4efb0dca30fbde67d6bbc905a3cdbe6d 771786a53cef53e7c2b77bba077ebda574aa15cc M xdebug_stack.c

So it works on the commit
aim-server[~/tmp/xdebug]$ git checkout 669a81c9ba59905b2177c4dde77899027a7a8953^1

but it doesn't work
on this commit

aim-server[~/tmp/xdebug]$ git checkout 669a81c9ba59905b2177c4dde77899027a7a8953

derick

2017-11-23 11:47

administrator   ~0004486

OK, as you're running this with PHP having debug enabled, could you run this with gdb:

gdb --args /opt/phpfarm/inst/php-7.2.0RC6/bin/php p.php

end then on the GDB prompt:

run

and when it crashes:

bt full

and add all the output as a file to this ticket.

ildar

2017-11-23 11:55

reporter   ~0004487

I have uploaded gdb.txt

derick

2017-11-23 13:00

administrator   ~0004488

Can you run the following in the Xdebug source directory:

phpize && ./configure && make clean && make -j 5 all

(and then copy the generated xdebug.so to the right place, or use "make install")

I am thinking it might not have picked up a change in a .h file.

ildar

2017-11-23 13:14

reporter   ~0004489

I have tried

1)
/opt/phpfarm/inst/php-7.2.0RC6/bin/phpize
./configure --enable-xdebug --with-php-config=/opt/phpfarm/inst/php-7.2.0RC6/bin/php-config
make clean
make -j 5 all

As result it works!

2)
/opt/phpfarm/inst/php-7.2.0RC6/bin/phpize
./configure --enable-xdebug --with-php-config=/opt/phpfarm/inst/php-7.2.0RC6/bin/php-config
make clean
make

It works in this way too.

It seems
'make clean' must be launched every time.

Sorry for the false bug request.

Thank you.

ildar

2017-11-23 13:16

reporter   ~0004490

I have changed my instruction to build

/opt/phpfarm/inst/php-7.2.0RC6/bin/phpize
./configure --enable-xdebug --with-php-config=/opt/phpfarm/inst/php-7.2.0RC6/bin/php-config
make clean;make
cpi modules/xdebug.so /opt/phpfarm/inst/php-7.2.0RC6/lib/php/extensions/xdebug2x.so
sudo -E vim /opt/phpfarm/inst/php-7.2.0RC6/lib/php.ini
zend_extension=/opt/phpfarm/inst/php-7.2.0RC6/lib/php/extensions/xdebug2x.so

ildar

2017-11-23 13:20

reporter   ~0004491

May be
make clean should be added here
https://xdebug.org/docs/install ?

ildar

2017-11-23 13:21

reporter   ~0004492

and here
https://github.com/derickr/xdebug

derick

2017-11-23 18:30

administrator   ~0004493

Thanks for the great report. And good to know it wasn't actually a bug after all.

The "make clean" is only really needed when you have already compiled Xdebug in the same directory before and I have changed a header file. There is a "./rebuild.sh" script in Xdebug's source checkout to do all the steps for you.

I've updated the documentation at https://github.com/xdebug/xdebug#xdebug