php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55194 PEAR doesn't work with empty php.ini files
Submitted: 2011-07-12 22:21 UTC Modified: 2011-07-13 17:31 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: kalessin at kalessin dot fr Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
 [2011-07-12 22:21 UTC] kalessin at kalessin dot fr
Description:
------------
I'm using PEAR 1.9.0, but newer version are also affected.

PEAR fails to open and parse an empty php.ini file because the return value of file() is not checked correctly (see attached patch).

It's easy to end up with an empty php.ini file when you set the php_ini configuration variable to a custom location.

The attached patch applies to SVN r313186

Best regards

PS: It's not clear where this bug should be reported, the PEAR website doesn't seem to have the concept of bugs in PEAR itself but only in packages…

Test script:
---------------
#!/bin/sh

php_ini=`mktemp`

pear config-set php_ini $php_ini user
pecl install mongo

rm -f $php_ini


Expected result:
----------------
[..]
install ok: channel://pecl.php.net/mongo-1.2.1
Extension mongo enabled in php.ini
% 

Actual result:
--------------
[...]
install ok: channel://pecl.php.net/mongo-1.2.1
php.ini "/tmp/tmp.V6wU8jpMA4" could not be read
You should add "extension=mongo.so" to php.ini
% 

Patches

pear_fix_opening_of_empty_php_ini_files.patch (last revision 2011-07-13 02:22 UTC by kalessin at kalessin dot fr)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-13 07:48 UTC] till@php.net
-Summary: PEAR doesn't work with empty php.ini files +Summary: PEAR doesn't honor the ext_dir configuration variable -Status: Open +Status: Bogus
 [2011-07-13 07:48 UTC] till@php.net
It's bogus anyway.

It's not supposed to suggest that.

You'll have to set extension_dir in your php.ini so an extension is found and can 
be loaded. The complete path is never added to extension=foo.so.
 [2011-07-13 07:48 UTC] till@php.net
Sorry, somehow I f'd up the comment, what I meant to say was:

Please report bugs for pear on http://pear.php.net/pear

Also, your patch does literally nothing. !$foo and $foo === false are the same 
thing.

file() returns false when the path is incorrect.

Anyhow, please report over at PEAR.
 [2011-07-13 14:42 UTC] kalessin at kalessin dot fr
-Summary: PEAR doesn't honor the ext_dir configuration variable +Summary: PEAR doesn't work with empty php.ini files
 [2011-07-13 14:42 UTC] kalessin at kalessin dot fr
!$foo and $foo === false are not the same thing when $foo is an empty string.

I'm waiting for a confirmation e-mail to submit the bug to PEAR. It's not really clear if any kind of registration is required or if it works like here.
 [2011-07-13 17:31 UTC] kalessin at kalessin dot fr
This bug has been submitted again in the right bug tracker:

http://pear.php.net/bugs/bug.php?id=18665
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 16:01:28 2025 UTC