com php-src: Fix searching for catch blocks Since PHP-7.1 catch blocks are addressed with relative byte difference between two catch blocks as opposed
to absolute opcode number: sapi/phpdbg/phpdbg_utils.c sap i/phpdbg/tests/exceptions_001.phpt
| From: | Bob Weinand | Date: | Sun, 16 Oct 2016 10:34:10 +0000 |
| Subject: | com php-src: Fix searching for catch blocks Since PHP-7.1 catch blocks are addressed with relative byte difference between two catch blocks as opposed to absolute opcode number: sapi/phpdbg/phpdbg_utils.c sap i/phpdbg/tests/exceptions_001.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95116@lists.php.net to get a copy of this message | ||
Commit: 601ab6e9d0cdd52a7b86819ae2e604936e83f648
Author: Bob Weinand <bobwei9@hotmail.com> Sun, 16 Oct 2016 12:34:10 +0200
Parents: 9f472ba5e32fb2aac725b65fefb9a992ae66caee
Branches: PHP-7.1
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=601ab6e9d0cdd52a7b86819ae2e604936e83f648
Log:
Fix searching for catch blocks
Since PHP-7.1 catch blocks are addressed with relative byte difference between two catch blocks as
opposed to absolute opcode number
Changed paths:
M sapi/phpdbg/phpdbg_utils.c
M sapi/phpdbg/tests/exceptions_001.phpt
Diff:
diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c
index 3314099..642c1de 100644
--- a/sapi/phpdbg/phpdbg_utils.c
+++ b/sapi/phpdbg/phpdbg_utils.c
@@ -772,7 +772,7 @@ PHPDBG_API zend_bool phpdbg_check_caught_ex(zend_execute_data *execute_data, zen
return 1;
}
- catch = cur->extended_value;
+ catch += cur->extended_value / sizeof(zend_op);
} while (!cur->result.num);
return 0;
diff --git a/sapi/phpdbg/tests/exceptions_001.phpt b/sapi/phpdbg/tests/exceptions_001.phpt
index 991ea1c..9998965 100644
--- a/sapi/phpdbg/tests/exceptions_001.phpt
+++ b/sapi/phpdbg/tests/exceptions_001.phpt
@@ -14,12 +14,12 @@ prompt> handle first
00017: } catch (\Exception $e) {
00018: var_dump($e);
prompt> frame #0: {closure}() at %s:16
-frame #1: {main} at %s:20
+frame #1: {main} at %s:22
prompt> 3
prompt> [Uncaught Error in %s on line 16]
Error: Call to undefined function foo() in %s:16
Stack trace:
-#0 %s(20): {closure}()
+#0 %s(22): {closure}()
#1 {main}
[Script ended normally]
prompt>
@@ -42,5 +42,7 @@ prompt>
foo(); // Error
} catch (\Exception $e) {
var_dump($e);
+ } catch (\ParseError $e) {
+ var_dump($e);
}
})();