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

Bug #3230 Still getting Call-time pass-by-reference error even after your fix
Submitted: 2005-01-18 16:36 UTC
From: email at daveringoen dot com Assigned: justinpatrin
Status: Closed Package: DB_DataObject_FormBuilder
PHP Version: 5.0.2 OS: Mac OS X 10.3.7, Redhat ES 3
Roadmaps: (Not assigned)    
Subscription  


 [2005-01-18 16:36 UTC] email at daveringoen dot com
Description: ------------ I see that this useCallTimePassByReference variable has been added to control whether call time pass by reference is used, and I'm still getting errors, which completely puzzles me. I have allow_call_time_pass_reference = Off in my php.ini file, and I'm getting the errors below from FormBuilder. When I look at line 1189, I see that it is conditional on $this->useCallTimePassByReference, which is set false in the class, so I'm very puzzled why line 1189 is being called instead of line 1191, which passes by value. This error repeats on several other lines in FormBuilder.php, if ($this->useCallTimePassByReference) { $this->_do->prepareLinkedDataObject(&$do, $key); } else { $this->_do->prepareLinkedDataObject($do, $key); } If I turn allow_call_time_pass_reference = Off, I don't get the warnings. Still, this makes me think memory is getting corrupted or something, since it appears that $this->useCallTimePassByReference is being changed somehow. I have made no modifications to the FormBuilder.php source, which has: var $useCallTimePassByReference = false; on line 693. Reproduce code: --------------- require_once('DB/DataObject/FormBuilder.php'); require_once('db/db.php'); //require_once('includeObjects.php'); $qu = DB_DataObject::factory('Quintess_User'); $builder =& DB_DataObject_FormBuilder::create($qu); $form =& $builder->getForm(); if ($form->validate()) { $form->process(array(&$builder,'processForm'), false); echo 'New Quintess_User ID: '.$qu->quintess_user_uid; } echo $form->toHtml(); Expected result: ---------------- <normal display of rendered form> Actual result: -------------- Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /usr/local/php5/lib/php/DB/DataObject/ FormBuilder.php on line 1189 ... <normal display of rendered form>

Comments

 [2005-01-18 19:02 UTC] justinpatrin
Are you sure you're not setting this in your ini file...? Also, try just including DB/DataObject/FormBuilder.php and not doing anything. Does it stil complain? (One last thing, you should really use DB/DB.php, not db/db.php)
 [2005-01-18 19:42 UTC] email at daveringoen dot com
Absolutely sure. When I set allow_call_time_pass_reference = On, I don't get the errors (I said the opposite below by accident). When I set allow_call_time_pass_reference = Off, I do get the warnings. In both cases, I've never modified FormBuilder.php to set $useCallTimePassByReference to true--I'm using the stock "false" setting. Per your suggestion, I tried running with only this code: <?php //testFB.php require_once('DB/DataObject/FormBuilder.php'); ?> And I still get the error if allow_call_time_pass_reference = Off Regarding your comment: >>>(One last thing, you should really use DB/DB.php, not db/db.php) db/db.php is my own include file that sets up db connections. Perhaps you raise a good point--maybe there is a conflict there. I renamed that file to db/ dbConnections.php, but I still get the error.
 [2005-01-18 19:57 UTC] email at daveringoen dot com
Now I see what's doing it. It looks like the PHP Parser returns that warning at parse time, not at run time. Those lines of code aren't getting run, at least line 1189. I added print statements to FormBuilder around it, and they didn't print, which also explains why I couldn't get the breakpoints to work in Zend Studio Debugger. So it looks like it's still necessary to turn on "allow_call_time_pass_reference", even though FormBuilder isn't going to be making call-time pass-by- reference calls with its default setting of var $useCallTimePassByReference = false;
 [2005-01-19 00:41 UTC] justinpatrin
Hmmm, I forgot to turn that option off in my php.ini. Looks lie it may be a much larger problem. I'll look further into it.
 [2005-01-19 17:43 UTC] justinpatrin
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. I changed the call-time-pass-by-ref calls to use eval...this is not a preferred solution, but it's the only way to get aroudn the warnings. PHP gives the warnings when parsing, bot when running. A simple include of FB would emit the warnings.