Bug #73730 [Ana]: textdomain(null) throws a TypeError when strict_types is declared

From: Date: Tue, 13 Dec 2016 10:58:13 +0000
Subject: Bug #73730 [Ana]: textdomain(null) throws a TypeError when strict_types is declared
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205956@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73730&edit=1 ID: 73730 Updated by: nikic@php.net Reported by: enhanced dot ttssd+php at gmail dot com Summary: textdomain(null) throws a TypeError when strict_types is declared Status: Analyzed Type: Bug Package: Gettext related Operating System: CentOS Linux release 7.2.1511 (C PHP Version: 7.0.14 Block user comment: N Private report: N New Comment: This is not related to arginfo, the zpp signature does not allow it: https://github.com/php/php-src/blob/PHP-7.0.14/ext/gettext/gettext.c#L167 It should be "s?". Currently it handles the NULL case through a coercion to "". Previous Comments: ------------------------------------------------------------------------ [2016-12-13 10:18:52] cmb@php.net Indeed, the arginfo[1] is insufficient. [1] <https://github.com/php/php-src/blob/PHP-7.0.14/ext/gettext/gettext.c#L35> ------------------------------------------------------------------------ [2016-12-13 07:29:42] enhanced dot ttssd+php at gmail dot com Description: ------------ textdomain(null) throws a TypeError when strict_types is declared. Doc: https://secure.php.net/manual/en/function.textdomain.php#refsect1-function.textdomain-parameters > Parameters > text_domain > The new message domain, or NULL to get the current setting without changing it Without strict_types, it works fine(returns current setting). Test script: --------------- <?php declare(strict_types=1); var_dump(textdomain(null)); https://3v4l.org/BRUYj https://3v4l.org/eCF0b Expected result: ---------------- string(8) "messages" Actual result: -------------- PHP Fatal error: Uncaught TypeError: textdomain() expects parameter 1 to be string, null given ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73730&edit=1

« previous php.bugs (#205956) next »