Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.7.5

Bug #12403 Incorrect path search for config.conf file
Submitted: 2007-11-08 19:03 UTC
From: sunejensen Assigned: tias
Status: Closed Package: PEAR_Frontend_Web (version 0.7.1)
PHP Version: 4.4.7 OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 36 - 7 = ?

 
 [2007-11-08 19:03 UTC] sunejensen (Sune Jensen)
Description: ------------ In the file pearfrontendweb.php it searches for the config file in line 61, where it tries to find the path relatively the the pearfrontendweb.php: substr(dirname(__FILE__), 0, -strlen('PEAR/PEAR')) But as the pearfrontendweb.php file is located in PEAR/Frontendweb.php and not PEAR/PEAR/Frontendweb.php it returns an incorrect path. It should be: substr(dirname(__FILE__), 0, -strlen('PEAR')) (Additionally, it is possible when installing with go-pear.php to change what directory to install PEAR, so you can not even be sure that it is 'PEAR') Expected result: ---------------- The Webbased PEAR Package Manager Actual result: -------------- Cannot read the template file: "/usr/local/lib/php/data/PEAR_Frontend_Web/data/templates/top.inc.tpl.html" Cannot read the template file: "/usr/local/lib/php/data/PEAR_Frontend_Web/data/templates/error.tpl.html"

Comments

 [2008-01-15 20:20 UTC] tias (Tias Guns)
Hello, The line of code you are referring to is part of an array listing the most likely paths of the config file: $default_config_dirs = array( substr(dirname(__FILE__), 0, -strlen('PEAR/PEAR')), // strip PEAR/PEAR dirname($_SERVER['SCRIPT_FILENAME']), PEAR_CONFIG_SYSCONFDIR, ); This means all 3 possibilities will be tried, not just that one. These 3 options have a fairly high chance of getting to the config file, but as you said, it can be installed anywhere, so there is no way to be sure. The best thing to do for you is edit your index.php file (which calls PEAR_Frontend_Web) and set the config option $pear_user_config to your config file. I've added a warning that sais exactly this, if it can not find a valid config file, in latest CVS. Greetings, Tias
 [2008-01-15 21:20 UTC] sunejensen (Sune Jensen)
I understand your argumentation. Maybe the problem is that the file pearfrontendweb.php is located in the root of php_dir, and not in the PEAR folder. On my linux setup PEAR is configured with: php_dir: /usr/share/PEAR/ and the pearfrontendweb.php is installed in: /usr/share/PEAR/pearfrontendweb.php whereas eg. the PEAR_Validate class is installed in: /usr/share/PEAR/PEAR/Validate.php
 [2008-01-20 11:12 UTC] tias (Tias Guns)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Very true, very true ! Indeed the file PEAR/pearfrontendweb.php used to be PEAR/PEAR/WebInstaller.php I seem to have forgotten to change the dir-juggling when doing the move. There was code similar to this in 2 places, in both following code is used now: substr(dirname(__FILE__), 0, strrpos(dirname(__FILE__), DIRECTORY_SEPARATOR)); which effectively cuts the head directory, independant of what it is named. Thank you for the very accurate bugreport ! Tias