Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69475 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18269 invoked from network); 3 Oct 2013 08:59:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Oct 2013 08:59:24 -0000 Authentication-Results: pb1.pair.com header.from=remi@fedoraproject.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=remi@fedoraproject.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fedoraproject.org from 212.27.42.2 cause and error) X-PHP-List-Original-Sender: remi@fedoraproject.org X-Host-Fingerprint: 212.27.42.2 smtp2-g21.free.fr Linux 2.6 Received: from [212.27.42.2] ([212.27.42.2:39663] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/00-18027-9E13D425 for ; Thu, 03 Oct 2013 04:59:23 -0400 Received: from schrodingerscat.famillecollet.com (unknown [82.241.130.121]) by smtp2-g21.free.fr (Postfix) with ESMTP id 667BB4B006B for ; Thu, 3 Oct 2013 10:59:14 +0200 (CEST) Message-ID: <524D31E1.1050103@fedoraproject.org> Date: Thu, 03 Oct 2013 10:59:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: PHP Internals References: In-Reply-To: X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Streams constify API change in master leads to compilation warning for extensions From: remi@fedoraproject.org (Remi Collet) 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.