php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43915 INI parser no longer allows hyphens in directive names
Submitted: 2008-01-23 02:59 UTC Modified: 2008-02-04 20:45 UTC
From: sfox@php.net Assigned: jani (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3CVS-2008-01-23 (CVS) OS: irrelevant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sfox@php.net
New email:
PHP Version: OS:

 

 [2008-01-23 02:59 UTC] sfox@php.net
Description:
------------
Trying to load PHP-GTK extensions led to the discovery that we now get a  parser error (under doze, this is in the form of a message box). I tried with a 5.3-dev from December and got a different message saying that the hyphen is illegal syntax.

The INI directive, being for PHP-GTK, has a hyphen as part of its extension prefix.

All works fine with current CVS for 5_2 branch.

Reproduce code:
---------------
extension=php_gtk2.dll
php-gtk.codepage=CP1250
php-gtk.extensions=php_gtk_libglade2.dll

Expected result:
----------------
Codepage used by PHP-GTK to change to CP1250, and the PHP-GTK extension libglade to load.

Actual result:
--------------
(in a message box)

PHP Error
parse error in C:\sandbox\testarea\php.ini on line 10

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-23 11:13 UTC] jani@php.net
Assigning to myself, gotta check out later. The directive follow the rule of PHP variable names: hyphen (-) is illegal in those too. But then again, dot (.) is allowed in INI directive names. :D

 [2008-01-23 13:36 UTC] sfox@php.net
I thought INI directive names were tied up with the module initialization in TSRM/Zend, but discovered otherwise in the wee sma' hours of this morning.

It's possible to change the name just by altering the entries on the .c page (in the declaration and everywhere that mentions them), and they'll still format as normal with ini_get_all()/phpinfo(). 

It's still a bug, as in 'an undocumented change in behaviour'; if it's fixable I'm sure Andrei will be all sweetness and light. But if it isn't, the dot may be a good alternative for us - and a nicer error message a good alternative for everyone else out there.

FWIW I know the hyphen was pushing at boundaries. I can't actually remember how we got around the problem of the module name, it was so long ago... and the module API's changed since then.
 [2008-01-23 20:50 UTC] jani@php.net
As note to myself, changing this in zend_ini_scanner.l:

LABEL [a-zA-Z0-9][a-zA-Z0-9._]*

to

LABEL [a-zA-Z0-9][a-zA-Z0-9._-]*

Should fix this. Untested! :)

 [2008-01-24 00:30 UTC] sfox@php.net
You fibber! You know I tested it at least - and sent you a patch to make testing easy.
 [2008-02-04 20:45 UTC] jani@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 05:01:33 2025 UTC