Bug #16096 Updated: Gettype reports var as string; echo complains as array and it is an array

From: Date: Wed, 19 Jun 2002 05:00:06 +0000
Subject: Bug #16096 Updated: Gettype reports var as string; echo complains as array and it is an array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-11334@lists.php.net to get a copy of this message
ID: 16096 Updated by: php-bugs@lists.php.net Reported By: nico@vddi.co.za -Status: Feedback +Status: No Feedback Bug Type: Arrays related Operating System: Linux 2.3 (Suse 7.0) PHP Version: 4.0.6 New Comment: No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". Previous Comments: ------------------------------------------------------------------------ [2002-03-17 12:43:34] sander@php.net Can't reproduce with latest CVS. Can you try a snapshot from snaps.php.net? ------------------------------------------------------------------------ [2002-03-15 07:52:39] nico@vddi.co.za Below some code. The array PM_method is setup as a HTML form that is fed to the next stage where $act = 1. Note that gettype reports it as a string and echo can't print it because it is an array. Regards Nico nico@vddi.co.za <?php #phpinfo(); if ($act == 1){ echo "Print Vars <p>"; $TT = gettype($var); while (list($var, $value) = each($HTTP_POST_VARS)) { $TT = gettype($var); #echo "TTT $TT XX $var YY $PM_method[2] bb <p>"; echo "Gettype sees \$$var as a $TT<p>"; echo "Echo sees \$$var as an array $PM_method<p>"; echo "POST $var = $value<br>\n"; } # end while } # end if ($act == 1) if ($act == 0 || empty($act)){ ?> <form action="<?php echo $PHP_SELF ?>" method="post" name="form"> <table><tr><td style="text-align: right;">Bank Transfer:</td><td> <input type="checkbox" name="PM_method[2]" value="2" checked></td> <td style="text-align: right;">Cash:</td><td> <input type="checkbox" name="PM_method[1]" value="1" checked></td> <td style="text-align: right;">Cheque:</td><td> <input type="checkbox" name="PM_method[3]" value="3" checked></td> <td style="text-align: right;">Company Order:</td><td> <input type="checkbox" name="PM_method[10]" value="10" checked></td> </tr> <tr> <td style="text-align: right;">Voucher:</td><td> <input type="checkbox" name="PM_method[9]" value="9"></td> <td style="text-align: right;">American Express:</td><td> <input type="checkbox" name="PM_method[4]" value="4"></td> <td style="text-align: right;">Diners Club:</td><td> <input type="checkbox" name="PM_method[5]" value="5"></td> <td style="text-align: right;">Eurocard:</td><td> <input type="checkbox" name="PM_method[8]" value="8"></td> </tr> <tr> <td style="text-align: right;">Master Card:</td><td> <input type="checkbox" name="PM_method[7]" value="7"></td> <td style="text-align: right;">VISA:</td><td> <input type="checkbox" name="PM_method[6]" value="6"></td> </tr> </table> <input type="hidden" name="act" value="1"> <input type="submit" name="Submit" class="button" value="Register Supplier"> <input type="Reset" class="button"></div> </FORM> <?php ;} # end if ($act == 0 || empty($act) ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=16096&edit=1

« previous php.bugs (#11334) next »