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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: victor-php at boivie dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 20:01:36 2025 UTC