mirror of
https://github.com/php/php-src.git
synced 2025-08-20 01:14:28 +02:00
Add experimental APIs to get and clear the last exception
This commit is contained in:
parent
fd3d84ee52
commit
ee36612cef
8 changed files with 150 additions and 2 deletions
23
ext/rpc/java/except.php
Normal file
23
ext/rpc/java/except.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?
|
||||
$stack=new Java("java.util.Stack");
|
||||
$stack->push(1);
|
||||
|
||||
#
|
||||
# Should succeed and print out "1"
|
||||
#
|
||||
$result = $stack->pop();
|
||||
$ex = java_last_exception_get();
|
||||
if (!$ex) print "$result\n";
|
||||
|
||||
#
|
||||
# Should fail - note the "@" eliminates the warning
|
||||
#
|
||||
$result=@$stack->pop();
|
||||
$ex=java_last_exception_get();
|
||||
if ($ex) print $ex->toString();
|
||||
|
||||
#
|
||||
# Reset last exception
|
||||
#
|
||||
java_last_exception_clear();
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue