Bug #68845 [NEW]: Logical operator interpreted inside unquoted strings
From: vincent dot raman at macq dot eu
Operating system: Opensuse 13.2
PHP version: 5.6.4
Package: Unknown/Other Function
Bug Type: Bug
Bug description:Logical operator interpreted inside unquoted strings
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 bug report at https://bugs.php.net/bug.php?id=68845&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68845&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68845&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68845&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68845&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68845&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68845&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68845&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68845&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68845&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68845&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68845&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68845&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68845&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68845&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68845&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68845&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68845&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68845&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68845&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68845&r=mysqlcfg
Thread (2 messages)
- vincent dot raman at macq dot eu