php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54712 zend API should use const char * where appropriate
Submitted: 2011-05-11 19:47 UTC Modified: 2011-05-12 00:22 UTC
From: chantry dot xavier at gmail dot com Assigned:
Status: Not a bug Package: Compile Warning
PHP Version: 5.3.6 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
5 + 44 = ?
Subscribe to this entry?

 
 [2011-05-11 19:47 UTC] chantry dot xavier at gmail dot com
Description:
------------
All zend API functions should use const char * for strings.

Trying to build a C program using Zend with clang results in hundreds of 
warnings such as these :

foo.c:4975:5: warning: passing 'const char [7]' to parameter of type 'char *' 
discards qualifiers
    PARSE_PARAMETERS("rrlszz", &zbody, &zurl, &nb_fields, &line,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.c:4975:22: note: instantiated from:
    PARSE_PARAMETERS("rrlszz", &zbody, &zurl, &nb_fields, &line,
                     ^~~~~~~~
/usr/include/php5/Zend/zend_API.h:238:66: note: passing argument to parameter 
'type_spec' here
ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, 
...);
                                                                 ^



Patches

php-trunk-zend (last revision 2011-05-12 07:58 UTC by chantry dot xavier at gmail dot com)
php-5.3-zend.diff (last revision 2011-05-12 07:08 UTC by chantry dot xavier at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-11 23:30 UTC] johannes@php.net
-Status: Open +Status: Bogus
 [2011-05-11 23:30 UTC] johannes@php.net
If you can provide patches they will most likely be added. We improve this step by step but with low priority compared to other issues. As this is an already ongoing effort this bug is not needed.

(also mind: even though it's trivial we can change these published apis only in trunk, not released versions)
 [2011-05-12 00:22 UTC] felipe@php.net
BTW in trunk we already have 'const char *type_spec'.
 [2011-05-12 10:04 UTC] chantry dot xavier at gmail dot com
Out of curiosity, does adding const break the API ?

I noticed that trunk already had lots of these fixes, so I attached an updated 
patch for trunk, but I could not test it.
I am not even able to make php build system work on a recent debian (apparently 
libtool mess).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 22:01:29 2024 UTC