#29082 [Bgs]: Variable call line argument problem
| From: | markem at ev1 dot net | Date: | Sat, 10 Jul 2004 18:30:20 +0000 |
| Subject: | #29082 [Bgs]: Variable call line argument problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-62004@lists.php.net to get a copy of this message | ||
ID: 29082
User updated by: markem at ev1 dot net
Reported By: markem at ev1 dot net
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows98se
PHP Version: 4CVS-2004-07-10 (stable)
New Comment:
Ok. I went back to the O'Reilly book and re-read the section on
"Missing Parameters" on page 69 of the March 2002, First Edition. I
see where the warning message is stated to occur and I know about the
suppression of the warning messages. I can live with that.
This leaves me with question #2. That of why the null parameters are
not being interpreted as null parameters and instead PHP dies when it
attempts to interpret them. I feel that this is a valid problem as, in
some (but not all) other languages the empty set on call lines simply
becomes a null value. Further, PHP's dying in this case negates the
"Missing Parameters" section on page 69.
I will though, go talk with people on the help boards and see what they
say about this.
Thanks for you time and sorry about #1.
Later!
Mark
Previous Comments:
------------------------------------------------------------------------
[2004-07-10 14:25:08] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
.
------------------------------------------------------------------------
[2004-07-10 08:10:39] markem at ev1 dot net
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 this bug report at http://bugs.php.net/?id=29082&edit=1