From a91e08303ff45c1a071701d020503e7655ee5618 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 25 Jun 2013 14:18:51 +0800 Subject: [PATCH] Don't ignore array[0], E_STRICT instead --- lua.c | 5 ++--- tests/001.phpt | 2 +- tests/006.phpt | 2 +- tests/012.phpt | 11 +++++++++++ 4 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 tests/012.phpt diff --git a/lua.c b/lua.c index debbee7..a3f330a 100644 --- a/lua.c +++ b/lua.c @@ -454,9 +454,8 @@ int php_lua_send_zval_to_lua(lua_State *L, zval *val TSRMLS_DC) { break; case HASH_KEY_IS_LONG: if (idx == 0) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE - , "attempt to pass an array index begin with 0 to lua, the index 0 will be discarded"); - continue; + php_error_docref(NULL TSRMLS_CC, E_STRICT, + "attempt to pass an array index begin with 0 to lua"); } MAKE_STD_ZVAL(zkey); ZVAL_LONG(zkey, idx); diff --git a/tests/001.phpt b/tests/001.phpt index 9619a82..1fa28c1 100644 --- a/tests/001.phpt +++ b/tests/001.phpt @@ -13,4 +13,4 @@ $l->eval("invalid code"); --EXPECTF-- 12 -0.53657291800043 -Warning: Lua::eval(): lua error: [string "line"]:1: '=' expected near 'code' in %s on line %d +Warning: Lua::eval(): lua error: [string "line"]:1: %s near 'code' in %s on line %d diff --git a/tests/006.phpt b/tests/006.phpt index 39bbac9..ecb3dd9 100644 --- a/tests/006.phpt +++ b/tests/006.phpt @@ -28,7 +28,7 @@ Testing fine Hello PHP Testing broken -Warning: Lua::include(): lua error: %s '=' expected near 'fdrg' in %s on line %d +Warning: Lua::include(): lua error: %s near 'fdrg' in %s on line %d Testing return Array diff --git a/tests/012.phpt b/tests/012.phpt new file mode 100644 index 0000000..95030df --- /dev/null +++ b/tests/012.phpt @@ -0,0 +1,11 @@ +--TEST-- +Check for index 0 +--SKIPIF-- + +--FILE-- +assign("b", range(1, 0)); +?> +--EXPECTF-- +Strict Standards: Lua::assign(): attempt to pass an array index begin with 0 to lua in %s012.php on line %d