mirror of
https://github.com/php-win-ext/php-lua.git
synced 2026-03-24 00:52:12 +01:00
Don't ignore array[0], E_STRICT instead
This commit is contained in:
5
lua.c
5
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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
11
tests/012.phpt
Normal file
11
tests/012.phpt
Normal file
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Check for index 0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("lua")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$l = new lua();
|
||||
$l->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
|
||||
Reference in New Issue
Block a user