Re: Streams constify API change in master leads to compilation warning for extensions
| From: | Jakub Zelenka | Date: | Thu, 03 Oct 2013 09:27:41 +0000 |
| Subject: | Re: Streams constify API change in master leads to compilation warning for extensions | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-69477@lists.php.net to get a copy of this message | ||
>
> -PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper
> (const char *path, char **path_for_open, int options TSRMLS_DC);
>
> +PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper
> (const char *path, const char **path_for_open, int options TSRMLS_DC);
>
> While is absolutly safe (and often useful) to switch from (char *) to
> (const char *), it is not with (char **)
>
> No compatibility in ever way.
> ... expected ‘const char **’ but argument is of type ‘char **’ ....
> ... expected ‘char **’ but argument is of type ‘const char **’ ....
>
> So I agree, this one could probably be reverted.
>
> As I found awful having to see more code like this (ex from twig)
>
> #if PHP_API_VERSION >= 20100412
> zend_get_object_classname(object, (const char **) &class_name,
> &class_name_len TSRMLS_CC);
> #else
> zend_get_object_classname(object, &class_name, &class_name_len
> TSRMLS_CC);
> #endif
> return class_name;
> }
>
>
Yeah, this is just for (char **) -> (const char **)
I found this in php_stream_locate_url_wrapper. I think that this should be
changed to
PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper (const char *path,
char **path_for_open, int options TSRMLS_DC);
There is a similar change for php_glob_stream_path_split but it doesn't
have any influence on extensions as it is a static function.
Sorry about the zpp comment. It really didn't make any sense! :)
Jakub