Bug #68845 [Opn->Nab]: Logical operator interpreted inside unquoted strings
Edit report at https://bugs.php.net/bug.php?id=68845&edit=1
ID: 68845
Updated by: aharvey@php.net
Reported by: vincent dot raman at macq dot eu
Summary: Logical operator interpreted inside unquoted strings
-Status: Open
+Status: Not a bug
Type: Bug
Package: Unknown/Other Function
Operating System: Opensuse 13.2
PHP Version: 5.6.4
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
I think it's extremely unlikely we'd try to be more selective about this: this is long
standing PHP INI parsing behaviour.
Previous Comments:
------------------------------------------------------------------------
[2015-01-16 13:41:27] vincent dot raman at macq dot eu
Description:
------------
---
From manual page: http://www.php.net/function.parse-ini-file
---
parse_ini_file and parse_ini_string try to interpret loogical operator inside not quoted strings.
If we have keys equal to unquoted strings with '|', '&', '^', or
'!' inside, everything will be interpreted as numbers even if it was simple strings.
Furthermore, if the string starts with a "dual" operator like '|',
'&' or '^', php will say there is a syntax error. Same if we use
'!' in the middle of a string.
That is with ZEND_INI_SCANNER_NORMAL.
With ZEND_INI_SCANNER_RAW, we don't have the problem, but we have ini files from Zend framework
1 where we have
test = ^foo "bar"
It was translated as '^foo bar'. With ZEND_INI_SCANNER_RAW, it becomes '^foo
"bar"'. Which is not what we had with php5.4.
Test script:
---------------
var_dump(parse_ini_string('test = foo & bar'));
var_dump(parse_ini_string('test = &foo'));
var_dump(parse_ini_string('test = foo | bar'));
var_dump(parse_ini_string('test = |foo'));
var_dump(parse_ini_string('test = foo ^ bar'));
var_dump(parse_ini_string('test = ^foo'));
var_dump(parse_ini_string('test = foo ! bar'));
var_dump(parse_ini_string('test = !foo'));
Expected result:
----------------
If the text does not represent numbers, don't try to apply the operator.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68845&edit=1
Thread (2 messages)