|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-12-18 04:09 UTC] lukem at NetBSD dot org
Description: ------------ ext/standard/url.c::php_url_parse_ex() uses 'char *' pointers at various places where 'char const *' (aka 'const char *') pointers should be used instead. This causes problems when compiling php with a higher level of compiler warnings. The fix is trivial. Replace line 100 of ext/standard/url.c: char *s, *e, *p, *pp, *ue; with char const *s, *e, *p, *pp, *ue; PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
The error: ext/standard/url.c: In function `php_url_parse_ex': ext/standard/url.c:102: warning: assignment discards qualifiers from pointer target type The cause of the error is obvious; in the function php_url_parse_ex(): + the function argument str is declared as 'char const *str' + the variable s is declared as 'char *s' + the assignement statement in line 102 is: s = str; which attempts to lose the "const"ness of str. It turns out that all the 'char *' variables used in this function can be 'const char *' (or in php-use, 'char const *' -- same thing, although the former is the common idiom) because those variables refer to str (or derivatives) and don't need to modify the variable. I solved the warnings locally by adding the 'const' qualifier to the variable declaration for s,e,p,pp,ee as I mentioned in my first comment.