Re: Quickform: problem with register globals on
| From: | Jeroen Houben | Date: | Fri, 14 Mar 2003 13:16:30 +0000 |
| Subject: | Re: Quickform: problem with register globals on | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-4241@lists.php.net to get a copy of this message | ||
Bertrand Mansion wrote:
<jeroen@terena.nl> wrote :JeroenHi, I've finally found the error that has been bugging me for a couple of hours now. My quickform code gives me an error on my live server but works fine on my development machine. Fatal error: Call to a member function on a non-object in /usr/local/share/php/pear/HTML/QuickForm/group.php on line 272 It turns out I accidently put register globals "On" on my live server and that casuses the error. I switched it off again, which is better anyway, and the error is gone. I don't know if you could call this a bug. Anyway, here's the code (simplified readability) I'm using QuickForm 2.10. I <html><body> <?php require_once('HTML/QuickForm.php'); $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : 'default'; $form = new HTML_QuickForm('event', 'post'); $form->addElement('hidden','action','update'); $form->addElement('text','city','City',array("size"=>45,"maxlength"=>100)); $start['hour'] = &HTML_QuickForm::createElement('select','hours',null,array(1,2,3)); $start['min'] = &HTML_QuickForm::createElement('select','mins',null,array(4,5,6));If you use $start for both the group name and the array you want to fill the group with, then (with globals on) one of them will be overwritten and you will loose its values. I suggest you change $start to $startEl or whatever. BTW, you should also check if $_REQUEST is only set with globals on. Thanks. Everything works fine with register globals set to Off, I prefer to have it turned off anyway.