Public bug reported:

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'

** Affects: php5 (Ubuntu)
     Importance: Undecided
         Status: New

** Patch added: "php.ini patch"
   
https://bugs.launchpad.net/bugs/1242743/+attachment/3886287/+files/php.ini.patch

** Bug watch added: bugs.php.net/ #65939
   http://bugs.php.net/bug.php?id=65939

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1242743

Title:
  space before ";" breaks php.ini parsing

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1242743/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to