Last modified: 2012-01-19 22:07:40 UTC
Created attachment 7567 [details] patch for php_wikidiff2.cpp (r67994) When using GCC 4.4, `make` shows following errors: php_wikidiff2.cpp:36: error: invalid conversion from ‘const zend_function_entry*’ to ‘_zend_function_entry*’ php_wikidiff2.cpp:94: error: invalid conversion from ‘const char*’ to ‘char*’ see http://blog.flameeyes.eu/2009/07/02/how-not-to-fix-gcc-4-4-bugs We must use the const_cast.
I am using GCC 4.4 and I don't see any such error. What version of PHP? Did you customise CXXFLAGS or CFLAGS?
$ php --version PHP 5.2.13 (cli) (built: Mar 6 2010 12:40:51) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator $ phpize Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20060613 Zend Extension Api No: 220060519 $ gcc --version gcc (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2) I don't customize CXXFLAGS and CFLAGS, thanks. (in Makefile) CFLAGS = -g -O2 CXXFLAGS = -g -O2
Tim : maybe you have a different Zend API version which returns a const. You made the ret variable a constant : const Wikidiff2::String & ret = wikidiff2.execute(text1String, text2String, numContextLines); But my Zend_API.h specify a char* (the variable is 's' below): #define ZVAL_STRINGL(z, s, l, duplicate) { \ char *__s=(s); int __l=l; \ (z)->value.str.len = __l; \ (z)->value.str.val = (duplicate?estrndup(__s, __l):__s); \ (z)->type = IS_STRING; \ } My zend_API.h : /* $Id: zend_API.h,v 1.207.2.8.2.9 2007/12/31 07:20:02 sebastian Exp $ */ $ phpize Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20060613 Zend Extension Api No: 220060519 $ php -version PHP 5.2.12 (cli) (built: Feb 9 2010 00:34:23) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans $ gcc --version i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
Thanks for the patch, Kkkdc @jawiki. Can you still reproduce the problem?
(In reply to comment #4) > Thanks for the patch, Kkkdc @jawiki. Can you still reproduce the problem? Of course it's still reproducible, I haven't changed anything. The relevant declarations did change from PHP 5.2 to PHP 5.3. Both ZVAL_STRINGL() and _zend_module_entry were changed to accept a const. Updating summary appropriately. I will apply the patch.
Committed in r109574.