php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29341 $bar = empty(trim($foo)) ? 1 : 0 will generate error
Submitted: 2004-07-22 21:23 UTC Modified: 2004-07-22 21:40 UTC
From: victor-php at boivie dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.0 OS: FreeBSD, Windows XP
Private report: No CVE-ID: None
 [2004-07-22 21:23 UTC] victor-php at boivie dot com
Description:
------------
Look at the reproducable code below. 

Reproduce code:
---------------
$foo = ""; // Doesn't matter
$bar = empty(trim($foo)) ? 1 : 0;
echo $bar;

Expected result:
----------------
1

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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-22 21:40 UTC] philip@php.net
empty() takes on a variable, and trim($foo) is not a variable.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 12:01:30 2024 UTC