From: markem at ev1 dot net
Operating system: Windows98se
PHP version: 4CVS-2004-07-10 (stable)
PHP Bug Type: Scripting Engine problem
Bug description: Variable call line argument problem
Description:
------------
File #1:
################################################################################
# HTML Library
################################################################################
# Begin Table
################################################################################
function tb( $alignA, $bgPicA, $bgColorA, $borderA, $borderColorA,
$cellPaddingA, $cellSpacingA, $columnsA, $heightA, $widthA )
{
$theReply = "<table ";
if( isset($alignA) )$theReply .= "align='$alignA' ";
if( isset($bgPicA) )$theReply .= "background='$bgPicA' ";
if( isset($bgColorA) )$theReply .= "bgcolor='$bgColorA' ";
if( isset($borderA) )$theReply .= "border='$borderA' ";
if( isset($borderColorA) )$theReply .= "bordercolor='$borderColorA' ";
if( isset($cellPaddingA) )$theReply .= "cellpadding='$cellPaddingA' ";
if( isset($cellSpacingA) )$theReply .= "cellspacing='$cellSpacingA' ";
if( isset($columnsA) )$theReply .= "columns='$columnsA' ";
if( isset($heightA) )$theReply .= "height='$heightA' ";
if( isset($widthA) )$theReply .= "width='$widthA' ";
$theReply .= ">";
return $theReply;
}
File #2: (test program)
<?php
include "html.php";
$theLine = "";
$theLine .= tb( null,null,"#FFFFFF");
echo "$theLine\n";
?>
Running the above generates:
C:\apache\lib>php test.php
Content-type: text/html
X-Powered-By: PHP/4.3.1
PHP Warning: Missing argument 4 for tb() in c:\apache\lib\html.php on
line 7
PHP Warning: Missing argument 5 for tb() in c:\apache\lib\html.php on
line 7
PHP Warning: Missing argument 6 for tb() in c:\apache\lib\html.php on
line 8
PHP Warning: Missing argument 7 for tb() in c:\apache\lib\html.php on
line 8
PHP Warning: Missing argument 8 for tb() in c:\apache\lib\html.php on
line 8
PHP Warning: Missing argument 9 for tb() in c:\apache\lib\html.php on
line 8
PHP Warning: Missing argument 10 for tb() in c:\apache\lib\html.php on
line 8
<table bgcolor='#FFFFFF' ><tr ><td ></td></tr></table>
Expected result:
----------------
1. If not having to pass arguments to a function (variable call arguments)
is normal, then why does PHP generate a warning about missing arguments?
2. If variable call arguments are possible - why can you not call the
function in this manner:
$theLine .= tb(,,"#ffffff");
??????? PHP should treat the empty ",," as two nulls. Instead, an error
is generated by PHP and PHP dies.
--
Edit bug report at http://bugs.php.net/?id=29082&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29082&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29082&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=29082&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29082&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29082&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29082&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29082&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29082&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29082&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29082&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29082&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29082&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29082&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29082&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29082&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29082&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29082&r=float