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

Bug #3197 Incorrect case in a is_a
Submitted: 2005-01-14 02:47 UTC
From: php at mithis dot com Assigned:
Status: Bogus Package: HTML_QuickForm
PHP Version: Irrelevant OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2005-01-14 02:47 UTC] php at mithis dot com
Description: ------------ The code in RuleRegistry.php at line 217 reads if (is_a($element, 'html_quickform_group')) { it should read if (is_a($element, 'HTML_QuickForm_group')) { otherwise it will always evaulate to false. Reproduce code: --------------- Patch: --- RuleRegistry.php.orig 2005-01-14 12:53:53.000000000 +1030 +++ RuleRegistry.php 2005-01-14 12:54:00.000000000 +1030 @@ -214,7 +214,7 @@ { $jsIndex = isset($index)? '[' . $index . ']': ''; $tmp_reset = $reset? " var field = frm.elements['$elementName'];\n": ''; - if (is_a($element, 'html_quickform_group')) { + if (is_a($element, 'HTML_QuickForm_group')) { $value = " var {$elementName}Elements = '::"; for ($i = 0, $count = count($element->_elements); $i < $count; $i++) { $value .= $element->getElementName($i) . '::';

Comments

 [2005-01-14 07:01 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-01-15 02:20 UTC] php at mithis dot com
This occurs in php5, specially when using the __autoload option. PHP5 doesn't find a class called 'html_quickform_group' hence tries to use __autoload to find it. Use the following code to produce it. <?php function __autoload($classname) { print "Trying to find $classname"; } $form = new HTML_QuickForm('context', 'get'); $form->addElement('text', 'textfield', 'Some text'); $form->addRule('text', 'Some text is required.', 'required', '', 'client'); $fomr->display(); It will print out "Trying to find html_quickform_group" then the form. If you fix the case in RuleRegistry.php it will only output the form.
 [2005-01-15 08:29 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-01-15 09:28 UTC] php at mithis dot com
You may define an __autoload function which is automatically called in case you are trying to USE a class which hasn't been defined yet. By calling this function the scripting engine is given a last chance to load the class before PHP fails with an error. You are using a class when doing a is_a (to check that the current object is an instance of the class), hence __autoload is called. From the above it is clear that if __autoload is being called a class CAN NOT be found. What is the point of not fixing this, it's a simple one line change and doesn't not change the behaviour in any other instance?
 [2005-01-21 19:29 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-07-26 16:27 UTC] scott at crisscott dot com
Please reconsider fixing this bug. It is a bug within HTML_QuickForm and not with PHP itself or the implementation of __autoload. This implementation of __autoload: function __autoload($class) { include_once str_replace('_', '/', $class) . '.php'; } Should work for any PEAR class that follows the PEAR naming conventions. Even though HTML_QuickForm_group doesn't follow the PEAR naming conventions, proper capitalization would allow the __autoload implementation to work properly. It is unreasonable to expect every developer that uses HTML_QuickForm and PHP5 to add a special HTML_QuickForm clause to their __autoload function. A quick grep for is_a in my PEAR directory shows that Mail, Log, Net_SMTO, Console_Getargs, Console_Getopt, PHP_Beautifier, and PEAR all use is_a. Should I put in special statements to ignore all of their autoloads as well?
 [2005-07-26 18:17 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-07-26 18:26 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-07-26 18:51 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-07-26 18:56 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-07-26 19:42 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!