php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45067 empty(array_diff(...)) cause Fatal error
Submitted: 2008-05-22 15:40 UTC Modified: 2008-05-22 16:02 UTC
From: jjahson at gmail dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.2.6 OS: WXP(sp3),OSX 10.5.2,FreeBSD 6.3
Private report: No CVE-ID: None
 [2008-05-22 15:40 UTC] jjahson at gmail dot com
Description:
------------
I tried to compare two arrays and check result for emptyness - all these in one line, but instead I got a Fatal error.
If I assign return value of array_diff to variable and then check its emptyness - it works just like I expect.

Reproduce code:
---------------
<?php empty(array_diff(array(1,2), array(1,2))); ?>

Expected result:
----------------
true

Actual result:
--------------
Fatal error: Can't use function return value in write context in example.php on line 1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-22 16:02 UTC] colder@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

empty() works on variables, not expressions.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 05:01:31 2024 UTC