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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
43 - 5 = ?
Subscribe to this entry?

 
 [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: Tue May 07 02:01:30 2024 UTC