php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59013 compilation breaks with strict compiler
Submitted: 2009-12-30 06:49 UTC Modified: 2010-01-01 15:48 UTC
From: guenter@php.net Assigned:
Status: Closed Package: lua (PECL)
PHP Version: 5.2.11 OS: NetWare
Private report: No CVE-ID: None
 [2009-12-30 06:49 UTC] guenter@php.net
Description:
------------
Compilation of lua.c breaks with strict compilers like CodeWarrior for NetWare. See patch below which fixes these issues.

Reproduce code:
---------------
--- lua.c.orig	Mon Jul 13 15:21:15 2009
+++ lua.c	Mon Jul 13 16:20:59 2009
@@ -180,6 +180,7 @@
 {
 	char *value;
 	size_t value_len;
+	zval *akey,*aval;
 
 	switch (lua_type(L, index)) {
 	case LUA_TBOOLEAN:
@@ -191,7 +192,7 @@
 		break;
 		
 	case LUA_TSTRING:
-		value = lua_tolstring(L, index, &value_len);
+		value = (char *)lua_tolstring(L, index, &value_len);
 		ZVAL_STRINGL(ret, value, value_len, 1);
 		break;
 
@@ -200,10 +201,9 @@
 		/* notify lua to traverse the table */
 		lua_pushnil(L);
 
-		zval *akey,*aval;
 		ALLOC_INIT_ZVAL(akey);
 		ALLOC_INIT_ZVAL(aval);
- 		
+
 		/* table has been moved by one because of the pushnil */
 		while (lua_next(L, index-1) != 0)
 		{
@@ -211,8 +211,8 @@
 			MAKE_STD_ZVAL(aval);
 
 			/* `key' is at index -2 and `value' at index -1 */
-			php_lua_get_zval_from_stack(L,-2,akey);
-			php_lua_get_zval_from_stack(L,-1,aval);
+			php_lua_get_zval_from_stack(L,-2,akey TSRMLS_CC);
+			php_lua_get_zval_from_stack(L,-1,aval TSRMLS_CC);
 			
 			switch(Z_TYPE_P(akey))
 			{
@@ -282,7 +282,7 @@
 
 	if (Z_TYPE_P(prop) == IS_STRING) {
 		MAKE_STD_ZVAL(retval);
-		lua_getfield(L, LUA_GLOBALSINDEX, Z_STRVAL_P(prop) TSRMLS_CC);
+		lua_getfield(L, LUA_GLOBALSINDEX, Z_STRVAL_P(prop));
 		php_lua_get_zval_from_stack(L, -1, retval TSRMLS_CC);
 		retval->refcount--;
 	} else {



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-01 15:48 UTC] johannes at schlueters dot de
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC