ID: 31174
User updated by: lukem at NetBSD dot org
Reported By: lukem at NetBSD dot org
-Status: Feedback
+Status: Open
Bug Type: Compile Warning
Operating System: NetBSD
PHP Version: 4.3.10
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2004-12-19 20:22:57] [EMAIL PROTECTED]
Can you please show the exact warnings you are seeing.
------------------------------------------------------------------------
[2004-12-18 04:09:12] 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;
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31174&edit=1