php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25851 empty string evaluation
Submitted: 2003-10-13 08:56 UTC Modified: 2003-10-13 11:34 UTC
From: fabio dot sutto at libero dot it Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.3.3 OS: Win
Private report: No CVE-ID: None
 [2003-10-13 08:56 UTC] fabio dot sutto at libero dot it
Description:
------------
Comparison operator "===" doesn't work as it should


while (!feof ($this->link)) {
			
	$line = fgets($this->link, 4096)  ;

var_dump($line) ; //output string(1) " "


/*
'' is identical to false inside if
*/
if($line === false){
			                   			var_dump($line) ; //output bool(false)

}

}//end while


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-13 10:07 UTC] tony2001 at phpclub dot net
Have you tried this code:
<?php
$line = ' ';
var_dump($line === false);
?>
?

I can't reproduce it under PHP5-CVS & PHP4-CVS.
 [2003-10-13 11:34 UTC] sniper@php.net
It works just fine, you're just doing something wrong.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 17:01:34 2025 UTC