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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 20:01:29 2024 UTC