Bug #73730 [Ana->Csd]: textdomain(null) throws in strict mode
| From: | cmb@php.net | Date: | Sun, 10 Sep 2017 16:56:00 +0000 |
| Subject: | Bug #73730 [Ana->Csd]: textdomain(null) throws in strict mode | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-211032@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: cmb@php.net
Reported by: enhanced dot ttssd+php at gmail dot com
Summary: textdomain(null) throws in strict mode
-Status: Analyzed
+Status: Closed
Type: Bug
Package: Gettext related
Operating System: CentOS Linux release 7.2.1511 (C
PHP Version: 7.0.14
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4b746fce1c6f873a696ace4c98e0981a059f35c9
Log: Fixed bug #73730 (textdomain(null) throws in strict mode)
Previous Comments:
------------------------------------------------------------------------
[2017-09-10 16:48:29] cmb@php.net
> This is not related to arginfo, [â¦]
Of course! Thanks.
------------------------------------------------------------------------
[2016-12-13 10:58:12] nikic@php.net
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 "".
------------------------------------------------------------------------
[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