note 30279 added to function.require
| From: | petej-NO-SPAM-at-shaman-dot-ca at rack1 dot php dot net | Date: | Wed, 12 Mar 2003 21:50:23 +0000 |
| Subject: | note 30279 added to function.require | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45171@lists.php.net to get a copy of this message | ||
If you use (require|include)[_once], to return values, like so:
. . .
$val = require('foo.php');
. . .
you may encounter problems, including Apache seg faults, when using this returned value. For
example, if the aforementioned foo.php looks like this:
. . .
return array(1,2,3);
. . .
and you use the $val for something, it may not contain the value you expect it to, or it may seg
fault your php process. Regardless of the action it causes, you can prevent it by doing this
instead:
. . .
$ret = array(1,2,3);
return $ret;
. . .
Very annoying gotcha...
--
http://www.php.net/manual/en/function.require.php
http://master.php.net/manage/user-notes.php?action=edit+30279
http://master.php.net/manage/user-notes.php?action=delete+30279
http://master.php.net/manage/user-notes.php?action=reject+30279