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

Bug #13071 Incorrect lowercase driver class name
Submitted: 2008-02-06 01:31 UTC
From: hasbridge Assigned: justinpatrin
Status: Closed Package: DB_DataObject_FormBuilder (version 1.0.0RC7)
PHP Version: 5.2.5 OS: Ubuntu/7.10
Roadmaps: 1.0.0    
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 : 42 + 17 = ?

 
 [2008-02-06 01:31 UTC] hasbridge (Harold Asbridge)
Description: ------------ When calling DB_DataObject_FormBuilder::create, the method generates an incorrect lowercase class name, no matter what case you pass the $driver parameter in. Also, the $mainClass parameter is not used when calculating the class name, and it is also incorrectly all lowercase. Normally this does not cause a problem, as PHP classes are not case sensitive. However, when using the __autoload method to automatically include classes on case-sensitive systems, the filename needs to match the class name. In other words, the class at DB/DataObject/FormBuilder/Quickform.php contains a class named DB_DataObject_FormBuilder_QuickForm. __autoload needs the correct case to determine the file path to this class. Test script: --------------- // Sample autoload function function __autoload($class_name) { $namespace = explode('_', $class_name); $filename = array_pop($class_path).'.php'; $class_path = $namespace.'/'.$filename; if (file_exists($class_path)) { include($class_path); return true; } return false; } // Fails using default driver name $form = DB_DataObject_FormBuilder::create($do_sample); // Fails using custom driver name $form = DB_DataObject_FormBuilder::create($do_sample, false, 'CamelCase'); Expected result: ---------------- Suggested Fix: FormBuilder.php, line 908: function &create(&$do, $options = false, $driver = 'QuickForm', $mainClass = 'DB_DataObject_FormBuilder') FormBuilder.php, line 922: $className = $mainClass.'_'.$driver;

Comments

 [2008-02-06 06:03 UTC] justinpatrin (Justin Patrin)
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.