PHP 4.0 Bug #3023: Function parameters are empty when passed

From: Date: Wed, 22 Dec 1999 03:38:10 +0000
Subject: PHP 4.0 Bug #3023: Function parameters are empty when passed
Groups: php.dev 
Request: Send a blank email to php-dev+get-13927@lists.php.net to get a copy of this message
From: schmit@athenet.net Operating system: Red Hat 6.1 PHP version: 4.0 Beta 3 PHP Bug Type: Scripting Engine problem Bug description: Function parameters are empty when passed 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.

« previous php.dev (#13927) next »