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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: chantry dot xavier at gmail dot com
New email:
PHP Version: OS:

 

 [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 12:01:31 2024 UTC