PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject_FormBuilder » Bug #3230

Still getting Call-time pass-by-reference error even after your fix

Details

Submitted2005-01-18 16:36 UTC
Fromemail at daveringoen dot com
Assignedjustinpatrin
StatusClosed
PackageDB_DataObject_FormBuilder
PHP Version5.0.2
OSMac OS X 10.3.7, Redhat ES 3
Roadmaps(Not assigned)

Comments

[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>

[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;