php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3023 Function parameters are empty when passed
Submitted: 1999-12-21 22:38 UTC Modified: 1999-12-21 23:04 UTC
From: schmit at athenet dot net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Beta 3 OS: Red Hat 6.1
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: schmit at athenet dot net
New email:
PHP Version: OS:

 

 [1999-12-21 22:38 UTC] schmit at athenet dot net
I've been trying to get some user-defined functions to work in 4.0b3, and they all fail with variants of the following:

function rdfl($fname) {
   if ($fname = "") {
      return("No data");
   } else {
      return(readfile($fname));
   }
}

echo rdfl("/home/download/finger.inc");

This returns an error indicating no such file "". Which is TOTALLY bizzare since the $fname check should fail it then, but instead it drops into the readfile routine with a null string. What's up with that?

Another example:

function tstostr($timestamp,$fmt) {
   echo $timestamp . " (" . $fmt . ")";
   ...do some twiddling with regex...
   return(date($fmt,twiddled parameters));
}

echo tstostr($dbresult["dt"],"d/m/Y");

This echos out something along the following lines:

19992112 ()

Indicating the second parameter is empty, but even if I try to catch the empty parameter and replace with a default value, the paramter catch is ignored like there's data in the parameter, but anytime I try to manipulate the second parameter, I get a null string.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-12-21 23:04 UTC] rasmus at cvs dot php dot net
if($fname == "") { ... }
Note the == instead of = there
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 12:00:01 2026 UTC