space before ";" breaks php.ini parsing

Bug #1242743 reported by brainstorm
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php
Unknown
Unknown
php5 (Ubuntu)
Fix Released
Low
Unassigned
Trusty
Won't Fix
Undecided
Unassigned

Bug 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'

Tags: bitesize patch
Revision history for this message
brainstorm (brainstorm) wrote :
Revision history for this message
brainstorm (brainstorm) wrote :

Reported upstream over here too: https://bugs.php.net/bug.php?id=65939

It is a very simple patch, it would be lovely to see it patched in the current Saucy release.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "php.ini patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
brainstorm (brainstorm) wrote :

Well, the patch applies to upstream sourcecode, it does not apply directly on the php5 ubuntu package... but again, just 1 line needs to be modified.

Revision history for this message
Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

Does this affect PHP's own parsing of php.ini, or just third party tools?

Since upstream have fixed this, I see no problem with cherry-picking it into Trusty (or waiting for a merge).

However, I'm concerned about fixing this in Saucy. It would create a conffile prompt for everyone who has changed the package. Is this really necessary? Why can't ansible users simply supply their own php.ini, if it's just ansible that has trouble parsing it?

Revision history for this message
Robie Basak (racb) wrote :

> for everyone who has changed the package

Sorry. I meant for everyone who has changed php.ini.

Revision history for this message
brainstorm (brainstorm) wrote :

Yeah, good point regarding the interactive prompt, maybe it is not worth the hassle, one could wait for upstream to converge.

Thanks for your attention!

Robie Basak (racb)
Changed in php5 (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
tags: added: bitesize
Revision history for this message
Robie Basak (racb) wrote :

I'm dropping this to Priority: Low, since it's not my intention to fix this in Ubuntu directly, but instead wait for upstream.

Changed in php5 (Ubuntu):
importance: Medium → Low
Revision history for this message
Lucy Llewellyn (lucyllewy) wrote :

This issue is for Trusty Tahr, which ended mainstream support in 2019 and exits ESM in 2022. I vote we close this issue as WONTFIX (I don't have permission to set WONTFIX status on this issue).

Revision history for this message
Robie Basak (racb) wrote :

Thanks. Marking this Fix Released since it has been fixed in a newer Ubuntu release, but I can make a separate Trusty task Won't Fix to make the status for Trusty clear.

Changed in php5 (Ubuntu Trusty):
status: New → Won't Fix
Changed in php5 (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.