Bug #65939 [Opn->Csd]: space before ";" breaks php.ini parsing
| From: | sixd@php.net | Date: | Mon, 21 Oct 2013 21:21:50 +0000 |
| Subject: | Bug #65939 [Opn->Csd]: space before ";" breaks php.ini parsing | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-182369@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65939&edit=1
ID: 65939
Updated by: sixd@php.net
Reported by: brainstorm at nopcode dot org
Summary: space before ";" breaks php.ini parsing
-Status: Open
+Status: Closed
Type: Bug
Package: PHP options/info functions
Operating System: irrelevant
PHP Version: 5.5.5
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of sixd
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b6ceea4a25f667bfed6c26899dd55a274a3270d3
Log: Fixed bug #65939 (Space before ";" breaks php.ini parsing). (brainstorm at
nopcode dot org)
Previous Comments:
------------------------------------------------------------------------
[2013-10-21 15:00:26] brainstorm at nopcode dot org
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 this bug report at https://bugs.php.net/bug.php?id=65939&edit=1