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

Request #6984 Use of __FILE__ within require
Submitted: 2006-03-01 20:56 UTC
From: toggg Assigned:
Status: Open Package: Crypt_RSA (version 1.2.0b)
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


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 : 32 + 14 = ?

 
 [2006-03-01 20:56 UTC] toggg (bertrand Gugger)
Description: ------------ We noticed there is no source control of the package. Please add it to the PEAR CVS. Lines 109-116 of Crypt/RSA/MathLoader.php make use of dirname(__FILE__) : [code] $class_name = 'Crypt_RSA_Math_' . $wrapper_name; $class_filename = dirname(__FILE__) . '/Math/' . $wrapper_name . '.php'; if (!is_file($class_filename)) { $err_handler->pushError("can't find file [{$class_filename}] for RSA math wrapper [{$wrapper_name}]", CRYPT_RSA_ERROR_NO_FILE); return $err_handler->getLastError(); } require_once($class_filename); [/code] A PEAR guideline is to seldom use this way of including files. Since it is required that PEAR Base directory be added to the include path you should be able to do otherwise than use dirname(__FILE__). Please, consider you are killing the implementer ability to master it through h(er|is) include paths

Comments

 [2010-08-21 17:00 UTC] glen (Elan Ruusamäe)
 [2010-08-21 17:02 UTC] glen (Elan Ruusamäe)
sorry, don't use that patch (don't know how to delete patch from bug), did not notice it use is_file() which would need full path.
 [2010-08-21 17:04 UTC] glen (Elan Ruusamäe)
 [2010-08-21 17:05 UTC] glen (Elan Ruusamäe)
ok, this second version should work