php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29082 Variable call line argument problem
Submitted: 2004-07-10 08:10 UTC Modified: 2004-07-10 20:30 UTC
From: markem at ev1 dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4CVS-2004-07-10 (stable) OS: Windows98se
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: markem at ev1 dot net
New email:
PHP Version: OS:

 

 [2004-07-10 08:10 UTC] 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-10 14:25 UTC] 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 20:30 UTC] markem at ev1 dot net
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
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 14:01:36 2025 UTC