File: callback_exception.phpt

package info (click to toggle)
php-luasandbox 4.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 620 kB
  • sloc: ansic: 3,700; xml: 2,152; php: 64; makefile: 13; sh: 3
file content (19 lines) | stat: -rw-r--r-- 392 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--TEST--
Exception in a PHP function called from Lua
--FILE--
<?php

function throw_exception() {
	throw new Exception('message');
}
$sandbox = new LuaSandbox;
$sandbox->registerLibrary( 'test', array( 'throw_exception' => 'throw_exception' ) );
$f = $sandbox->loadString('test.throw_exception()');
try {
	$f->call();
} catch ( Exception $e ) {
	print $e->getMessage();
}

--EXPECT--
message