php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #63425
Patch Use_Tabs_And_Spaces revision 2012-11-03 09:21 UTC by anotherhero at gmail dot com
Patch ThrowExceptions revision 2012-11-03 09:00 UTC by anotherhero at gmail dot com

Patch Use_Tabs_And_Spaces for lua Bug #63425

Patch version 2012-11-03 09:21 UTC

Return to Bug #63425 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: anotherhero@gmail.com

Index: tests/001.phpt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- tests/001.phpt	(revision 328227)
+++ tests/001.phpt	(revision )
@@ -9,8 +9,12 @@
 $l->eval("print(b)");
 $l->eval('print("\n")');
 $l->eval("print(math.sin(b))");
+try {
-$l->eval("invalid code");
+    $l->eval("invalid code");
+} catch (LuaException $e) {
+    echo "\n".$e->getMessage();
+}
 --EXPECTF--
 12
 -0.53657291800043
-Warning: Lua::eval(): lua error: [string "line"]:1: %s near 'code' in %s on line %d
+lua error: [string "line"]:1: '=' expected near 'code'
Index: lua.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- lua.c	(revision 328227)
+++ lua.c	(revision )
@@ -670,8 +670,7 @@
 
 	bp = lua_gettop(L);
 	if (luaL_loadbuffer(L, statements, len, "line") || lua_pcall(L, 0, LUA_MULTRET, 0)) {
-		php_error_docref(NULL TSRMLS_CC, E_WARNING,
-				"lua error: %s", lua_tostring(L, -1));
+		zend_throw_exception_ex(lua_exception_ce, 0 TSRMLS_CC, "lua error: %s", lua_tostring(L, -1));
 		lua_pop(L, 1);
 		RETURN_FALSE;
 	} else {
@@ -720,8 +719,7 @@
 
 	bp = lua_gettop(L);
 	if (luaL_dofile(L, file)) {
-		php_error_docref(NULL TSRMLS_CC, E_WARNING,
-				"lua error: %s", lua_tostring(L, -1));
+		zend_throw_exception_ex(lua_exception_ce, 0 TSRMLS_CC, "lua error: %s", lua_tostring(L, -1));
 		lua_pop(L, 1);
 		RETURN_FALSE;
 	}  else {
Index: tests/006.phpt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- tests/006.phpt	(revision 328227)
+++ tests/006.phpt	(revision )
@@ -17,8 +17,12 @@
 foreach ($code as $n => $c) {
     echo "\nTesting $n\n";
     file_put_contents($filename, $c);
+    try {
-    $ret = $l->include($filename);
-	if ($ret) print_r($ret);
+        $ret = $l->include($filename);
+        if ($ret) print_r($ret);
+    } catch (LuaException $e) {
+        echo "\n".$e->getMessage();
+    }
     @unlink($filename);
 }
 ?>
@@ -28,8 +32,7 @@
 Hello PHP
 Testing broken
 
-Warning: Lua::include(): lua error: %s near 'fdrg' in %s on line %d
-
+lua error: %s:%d: '=' expected near 'fdrg'
 Testing return
 Array
 (
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 04:01:29 2024 UTC