Le 02/10/2013 20:41, Jakub Zelenka a écrit :
> Hi,
> 
> I was wondering why stream API has been changed in this commit:
> 
> https://github.com/php/php-src/commit/92d27ccb0574f901a107409a7fec92888fa2b82f
> 
> Basically all char pointers have been constified. The thing is that this
> commit leads to compilation warning for many extensions.
> 
> In my case I use php_stream_locate_url_wrapper and want to compile my
> extension (fann) without any warnings. 

Sorry to have not read enough carefully your mail.

-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;
}


Remi.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to