note 129130 added to function.parse-ini-string
| From: | Philo at main dot php dot net | Date: | Fri, 29 Dec 2023 11:39:04 +0000 |
| Subject: | note 129130 added to function.parse-ini-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221084@lists.php.net to get a copy of this message | ||
Hi,
Up to PHP 8.3 (at least), it seems that INI_SCANNER_TYPED is ignored when trying to get values from
constants.
For example :
<?php
// https://3v4l.org/qK5o8
const OK = true;
const KO = false;
const NIL = null;
$ini = <<<'INI'
a = TRUE
b = FALSE
c = null
d = 9223372036854775807
INI;
var_dump(parse_ini_string($ini, false, INI_SCANNER_NORMAL), parse_ini_string($ini, false,
INI_SCANNER_TYPED));
$ini = <<<'INI'
a = OK
b = KO
c = NIL
d = PHP_INT_MAX
INI;
var_dump(parse_ini_string($ini, false, INI_SCANNER_NORMAL), parse_ini_string($ini, false,
INI_SCANNER_TYPED));
?>
I thought it was worth mentioning.
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 2a01:e0a:95c:f140:a00f:27c8:cf6b:c0e0)
----
Manual Page -- https://php.net/manual/en/function.parse-ini-string.php
Edit -- https://main.php.net/note/edit/129130
Del: integrated -- https://main.php.net/note/delete/129130/integrated
Del: useless -- https://main.php.net/note/delete/129130/useless
Del: bad code -- https://main.php.net/note/delete/129130/bad+code
Del: spam -- https://main.php.net/note/delete/129130/spam
Del: non-english -- https://main.php.net/note/delete/129130/non-english
Del: in docs -- https://main.php.net/note/delete/129130/in+docs
Del: other reasons-- https://main.php.net/note/delete/129130
Reject -- https://main.php.net/note/reject/129130
Search -- https://main.php.net/manage/user-notes.php