Bug #65939 [NEW]: space before ";" breaks php.ini parsing

From: Date: Mon, 21 Oct 2013 15:00:26 +0000
Subject: Bug #65939 [NEW]: space before ";" breaks php.ini parsing
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182364@lists.php.net to get a copy of this message
From:             brainstorm at nopcode dot org
Operating system: irrelevant
PHP version:      5.5.5
Package:          PHP options/info functions
Bug Type:         Bug
Bug description:space before ";" breaks php.ini parsing

Description:
------------
The following php.ini snippet is found in the newest releases of php.ini
(found un downloads section and Ubuntu 13.10):




; If disabled, all PHPDoc comments are dropped from the code to reduce
the
 ;size of the optimized code.
;opcache.save_comments=1




The space before " ;size" breaks automation systems like Ansible which
tries to parse it as a correctly formatted .ini file.

Test script:
---------------
Apparently it only breaks with builtin MacOSX Python distribution, so
you would not be able to reproduce the above exception if running
GNU/Linux or others.

#!/usr/bin/python

import ConfigParser, os

config = ConfigParser.ConfigParser()
config.readfp(open('php.ini'))
print config.get('PHP', 'max_execution_time')

Expected result:
----------------
It should return the value of the attribute instead of raising an
exception:

$ python phpparse.py
30

Actual result:
--------------
TASK: [ini_file dest=/etc/php5/apache2/php.ini section=PHP
option=max_execution_time value=200] ***
fatal: [86.50.168.69] => failed to parse: Traceback (most recent call
last):
  File
"/root/.ansible/tmp/ansible-1382344679.91-7968522912177/ini_file", line
1116, in <module>
    main()
  File
"/root/.ansible/tmp/ansible-1382344679.91-7968522912177/ini_file", line
177, in main
    changed = do_ini(module, dest, section, option, value, state,
backup)
  File
"/root/.ansible/tmp/ansible-1382344679.91-7968522912177/ini_file", line
99, in do_ini
    cp.readfp(f)
  File "/usr/lib/python2.7/ConfigParser.py", line 324, in readfp
    self._read(fp, filename)
  File "/usr/lib/python2.7/ConfigParser.py", line 546, in _read
    raise e
ConfigParser.ParsingError: File contains parsing errors:
/etc/php5/apache2/php.ini
	[line 1859]: ' ;size of the optimized code.\n'

-- 
Edit bug report at https://bugs.php.net/bug.php?id=65939&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=65939&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=65939&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=65939&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65939&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65939&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65939&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65939&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65939&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65939&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65939&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=65939&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=65939&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65939&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65939&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65939&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65939&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65939&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65939&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65939&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65939&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#182364) next »