ID: 33466
User updated by: clynx at succont dot de
Reported By: clynx at succont dot de
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: FreeBSD 4.10/FreeBSD 5.4/WinXP
PHP Version: 5CVS-2005-06-24 (dev)
New Comment:
But array_intersect does not return an 'expression' it returns an
Array. And IMHO Arrays should be useable where they are returned.
Maybe, could you tell me a little bit more about the word 'expression'
you used. Is every return value in PHP a expression until it is
assigned to a Variable? If so, is that handled in some part of the
Manual?
Thanks
Previous Comments:
------------------------------------------------------------------------
[2005-06-24 15:22:09] [EMAIL PROTECTED]
array_shift() accepts only variables passed by reference.
Obviously an expression result is not a variable.
------------------------------------------------------------------------
[2005-06-24 15:18:58] clynx at succont dot de
Description:
------------
When you try to use array_intersect in combination with a different
Function, it leads to a strange Error Message.
The Reproduce Code give the Error while the following does not:
<?php
$array1 = array('foo', 'bar', 'test');
$array2 = array('foo', 'me' );
$result = array_intersect( $array1, $array2 );
var_dump( array_shift( $result ) );
?>
And as far as array_intersect retuns an Array (a Variable ;o) this
Error is a little bit strange.
Reproduce code:
---------------
<?php
$array1 = array('foo', 'bar', 'test');
$array2 = array('foo', 'me' );
var_dump( array_shift( array_intersect( $array1, $array2 ) ) );
?>
Expected result:
----------------
webdev# php /htdocs/beta.webdev/succont.Unitized/test.php
string(3) "foo"
Actual result:
--------------
webdev# php /htdocs/beta.webdev/succont.Unitized/test.php
PHP Fatal error: Only variables can be passed by reference in
/usr/local/htdocs/beta.webdev/succont.Unitized/test.php on line 4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33466&edit=1