View Issue Details

IDProjectCategoryView StatusLast Update
0001012XdebugUsage problems (Wrong Results)public2016-11-29 10:50
ReporterdemjanAssigned Toderick 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
Product Version 
Target VersionFixed in Version 
Summary0001012: nested try catch blocks ends up in PHP Fatal error
Descriptionexpected result:

"abcd"

current result:

"a"

and an entry in php.log

[03-Dec-2013 12:39:30 UTC] PHP Fatal error: Uncaught exception 'Exception' with message 'message' in <file>:<line>
Stack trace:
#0 {main}
  thrown in <file> on line <line>

Steps To Reproducetry {
    try {
        echo "a";
        throw new Exception('message');
    } catch (Exception $e) {
        echo "b";
    }
    echo "c";
} catch (Exception $e) {
}
echo "d";
Additional InformationPHP Version 5.3.14

System Linux t510 3.2.0-56-generic 0000086-Ubuntu SMP Wed Oct 23 09:20:45 UTC 2013 x86_64
Build Date Jun 19 2012 07:35:14
Configure Command './configure' '--prefix=/usr/local/zend' '--with-config-file-path=/usr/local/zend/etc' '--with-config-file-scan-dir=/usr/local/zend/etc/conf.d' '--disable-debug' '--enable-inline-optimization' '--disable-all' '--enable-libxml' '--enable-session' '--enable-spl' '--enable-xml' '--enable-hash' '--enable-reflection' '--with-pear' '--with-apxs2=/usr/local/zend/apache2/bin/apxs' '--with-layout=GNU' '--enable-filter' '--with-pcre-regex' '--with-zlib=/usr/local/zlib-1.2.3' '--enable-simplexml' '--enable-dom' '--with-libxml-dir=/usr/local/libxml2-2.7.7' '--with-openssl=/usr/local/openssl-0.9.8o' '--enable-pdo' '--with-pdo-sqlite' '--with-readline=/usr/local/readline-5.2' '--with-iconv' '--with-sqlite3' '--disable-phar' '--enable-xmlwriter' '--enable-xmlreader'
Server API Apache 2.0 Handler
Virtual Directory Support disabled
Configuration File (php.ini) Path /usr/local/zend/etc
Loaded Configuration File /usr/local/zend/etc/php.ini
Scan this dir for additional .ini files /usr/local/zend/etc/conf.d
Additional .ini files parsed /usr/local/zend/etc/conf.d/ZendGlobalDirectives.ini, /usr/local/zend/etc/conf.d/bcmath.ini, /usr/local/zend/etc/conf.d/bz2.ini, /usr/local/zend/etc/conf.d/calendar.ini, /usr/local/zend/etc/conf.d/codetracing.ini, /usr/local/zend/etc/conf.d/ctype.ini, /usr/local/zend/etc/conf.d/curl.ini, /usr/local/zend/etc/conf.d/datacache.ini, /usr/local/zend/etc/conf.d/debugger.ini, /usr/local/zend/etc/conf.d/dserver.ini, /usr/local/zend/etc/conf.d/exif.ini, /usr/local/zend/etc/conf.d/extension_manager.ini, /usr/local/zend/etc/conf.d/fileinfo.ini, /usr/local/zend/etc/conf.d/ftp.ini, /usr/local/zend/etc/conf.d/gd.ini, /usr/local/zend/etc/conf.d/gettext.ini, /usr/local/zend/etc/conf.d/gmp.ini, /usr/local/zend/etc/conf.d/imagick.ini, /usr/local/zend/etc/conf.d/imap.ini, /usr/local/zend/etc/conf.d/interexa.ini, /usr/local/zend/etc/conf.d/intl.ini, /usr/local/zend/etc/conf.d/jbridge.ini, /usr/local/zend/etc/conf.d/jobqueue.ini, /usr/local/zend/etc/conf.d/json.ini, /usr/local/zend/etc/conf.d/lda.ini, /usr/local/zend/etc/conf.d/ldap.ini, /usr/local/zend/etc/conf.d/loader.ini, /usr/local/zend/etc/conf.d/mbstring.ini, /usr/local/zend/etc/conf.d/mcrypt.ini, /usr/local/zend/etc/conf.d/memcache.ini, /usr/local/zend/etc/conf.d/memcached.ini, /usr/local/zend/etc/conf.d/mongo.ini, /usr/local/zend/etc/conf.d/monitor.ini, /usr/local/zend/etc/conf.d/mssql.ini, /usr/local/zend/etc/conf.d/mysql.ini, /usr/local/zend/etc/conf.d/mysqli.ini, /usr/local/zend/etc/conf.d/oci8.ini, /usr/local/zend/etc/conf.d/odbc.ini, /usr/local/zend/etc/conf.d/optimizerplus.ini, /usr/local/zend/etc/conf.d/pagecache.ini, /usr/local/zend/etc/conf.d/pcntl.ini, /usr/local/zend/etc/conf.d/pdo_dblib.ini, /usr/local/zend/etc/conf.d/pdo_mysql.ini, /usr/local/zend/etc/conf.d/pdo_oci.ini, /usr/local/zend/etc/conf.d/pdo_odbc.ini, /usr/local/zend/etc/conf.d/pdo_pgsql.ini, /usr/local/zend/etc/conf.d/pgsql.ini, /usr/local/zend/etc/conf.d/phar.ini, /usr/local/zend/etc/conf.d/posix.ini, /usr/local/zend/etc/conf.d/sc.ini, /usr/local/zend/etc/conf.d/shmop.ini, /usr/local/zend/etc/conf.d/soap.ini, /usr/local/zend/etc/conf.d/sockets.ini, /usr/local/zend/etc/conf.d/sqlite.ini, /usr/local/zend/etc/conf.d/ssh2.ini, /usr/local/zend/etc/conf.d/sysvmsg.ini, /usr/local/zend/etc/conf.d/sysvsem.ini, /usr/local/zend/etc/conf.d/sysvshm.ini, /usr/local/zend/etc/conf.d/thrift_protocol.ini, /usr/local/zend/etc/conf.d/tidy.ini, /usr/local/zend/etc/conf.d/tokenizer.ini, /usr/local/zend/etc/conf.d/uploadprogress.ini, /usr/local/zend/etc/conf.d/utils.ini, /usr/local/zend/etc/conf.d/wddx.ini, /usr/local/zend/etc/conf.d/xmlrpc.ini, /usr/local/zend/etc/conf.d/xsl.ini, /usr/local/zend/etc/conf.d/zf2.ini, /usr/local/zend/etc/conf.d/zip.ini
PHP API 20090626
PHP Extension 20090626
Zend Extension 220090626
Zend Extension Build API220090626,NTS
PHP Extension Build API20090626,NTS
Debug Build no
Thread Safety disabled
Zend Memory Manager enabled
Zend Multibyte Support disabled
IPv6 Support enabled
Registered PHP Streams https, ftps, compress.zlib, php, file, glob, data, http, ftp, compress.bzip2, phar, ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp, zip
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters zlib.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, bzip2.*, mcrypt.*, mdecrypt.*



xdebug
xdebug support enabled
Version 2.2.3
IDE Key no value

Supported protocols Revision
DBGp - Common DeBuGger Protocol $Revision: 1.145 $

Directive Local Value Master Value
xdebug.auto_trace Off Off
xdebug.cli_color 0 0
xdebug.collect_assignments Off Off
xdebug.collect_includes On On
xdebug.collect_params 0 0
xdebug.collect_return Off Off
xdebug.collect_vars Off Off
xdebug.coverage_enable On On
xdebug.default_enable On On
xdebug.dump.COOKIE no value no value
xdebug.dump.ENV no value no value
xdebug.dump.FILES no value no value
xdebug.dump.GET no value no value
xdebug.dump.POST no value no value
xdebug.dump.REQUEST no value no value
xdebug.dump.SERVER no value no value
xdebug.dump.SESSION no value no value
xdebug.dump_globals On On
xdebug.dump_once On On
xdebug.dump_undefined Off Off
xdebug.extended_info On On
xdebug.file_link_format no value no value
xdebug.idekey no value no value
xdebug.max_nesting_level 10000 10000
xdebug.overload_var_dump On On
xdebug.profiler_aggregate Off Off
xdebug.profiler_append Off Off
xdebug.profiler_enable Off Off
xdebug.profiler_enable_trigger On On
xdebug.profiler_output_dir /tmp /tmp
xdebug.profiler_output_name cachegrind.out.%R.%p cachegrind.out.%R.%p
xdebug.remote_autostart Off Off
xdebug.remote_connect_back Off Off
xdebug.remote_cookie_expire_time 3600 3600
xdebug.remote_enable On On
xdebug.remote_handler dbgp dbgp
xdebug.remote_host localhost localhost
xdebug.remote_log no value no value
xdebug.remote_mode req req
xdebug.remote_port 9000 9000
xdebug.scream Off Off
xdebug.show_exception_trace Off Off
xdebug.show_local_vars Off Off
xdebug.show_mem_delta On On
xdebug.trace_enable_trigger On On
xdebug.trace_format 1 1
xdebug.trace_options 0 0
xdebug.trace_output_dir /tmp /tmp
xdebug.trace_output_name trace.%R.%p trace.%R.%p
xdebug.var_display_max_children 128 128
xdebug.var_display_max_data 512 512
xdebug.var_display_max_depth 3 3
TagsNo tags attached.
Operating SystemLinux t510 3.2.0-56-generic 0000086-Ubuntu SMP
PHP Version5.3.14

Activities

derick

2013-12-03 13:43

administrator   ~0002624

This works just fine for me, with PHP 5.3.22 though:

[PHP: 5.3.22-dev ]
derick@whisky:~ $ cat /tmp/1012.php
<?php
try {
    try {
        echo "a";
        throw new Exception('message');
    } catch (Exception $e) {
        echo "b";
    }
    echo "c";
} catch (Exception $e) {
}
echo "d";
?>

[PHP: 5.3.22-dev ]
php -n -dzend_extension=/usr/local/php/5.3dev/lib/php/extensions/debug-non-zts-20090626/xdebug.so /tmp/1012.php
abcd

[PHP: 5.3.22-dev ]
derick@whisky:/tmp

Can you try this with just the code you pasted on the CLI like I did?

demjan

2013-12-03 14:30

reporter   ~0002625

I forgot to mention, that originally i run this code via php apache module. From CLI it works as expected. Actually i use zend-server-ce-php-5.3 (5.6.0+b311). I substituted the original zend debug extension with Xdebug extension, as far as i can remember, i have compiled it from the sources.

P.S.
With disabled xdebug-extension this code procuces the expected result also from php apache module.

pgnewikow

2014-01-28 18:11

reporter   ~0002671

Occurs also on

Windows - ZendServer with php 5.3.14

our temporary workaround:

<?php
try {
    (1==1);
    try {
        echo "a";
        throw new Exception('message');
    } catch (Exception $e) {
        echo "b";
    }
    echo "c";
} catch (Exception $e) {
}
echo "d";
?>

perhaps this can help to find the problem.

derick

2016-11-28 21:26

administrator   ~0003826

Does this still cause issues for you?

pgnewikow

2016-11-29 09:36

reporter   ~0003844

we are not using 5.3 anymore, and I forgot about this bug,
I just tested it and it does not occur anymore

demjan

2016-11-29 10:37

reporter   ~0003845

Last edited: 2016-11-29 10:38

View 2 revisions

seems to be fixed

# php -v

PHP 5.6.28 (cli) (built: Nov 13 2016 10:09:32)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
    with Zend Extension Manager v8.5.0, Copyright (c) 2003-2015, by Zend Technologies
    - with Zend Data Cache v8.5.0, Copyright (c) 2004-2015, by Zend Technologies
    - with Zend Job Queue v8.5.0, Copyright (c) 2004-2015, by Zend Technologies
    - with Zend Session Clustering v8.5.0, Copyright (c) 2004-2015, by Zend Technologies
    - with Zend Utils v8.5.0, Copyright (c) 2004-2015, by Zend Technologies
    - with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    - with Zend Code Tracing v8.5.0, Copyright (c) 2009-2015, by Zend Technologies
    - with Zend Server Z-Ray v8.5.0, Copyright (c) 1999-2015, by Zend Technologies
    - with Zend Monitor v8.5.0, Copyright (c) 1999-2015, by Zend Technologies
    - with Zend Page Cache v8.5.0, Copyright (c) 2004-2015, by Zend Technologies

derick

2016-11-29 10:50

administrator   ~0003848

Perfect, thanks for letting me know. I'm closing this issue then.

Issue History

Date Modified Username Field Change
2013-12-03 12:56 demjan New Issue
2013-12-03 13:43 derick Note Added: 0002624
2013-12-03 13:43 derick Assigned To => derick
2013-12-03 13:43 derick Status new => feedback
2013-12-03 14:30 demjan Note Added: 0002625
2013-12-03 14:30 demjan Status feedback => assigned
2014-01-28 18:11 pgnewikow Note Added: 0002671
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-11-28 21:26 derick Note Added: 0003826
2016-11-28 21:26 derick Status assigned => feedback
2016-11-29 09:36 pgnewikow Note Added: 0003844
2016-11-29 10:37 demjan Note Added: 0003845
2016-11-29 10:37 demjan Status feedback => assigned
2016-11-29 10:38 demjan Note Edited: 0003845 View Revisions
2016-11-29 10:50 derick Note Added: 0003848
2016-11-29 10:50 derick Status assigned => resolved
2016-11-29 10:50 derick Resolution open => no change required