You are here: Re: Weird result?? php 4.4.0 « PHP Programming Language « IT news, forums, messages
Re: Weird result?? php 4.4.0

Posted by Bob Stearns on 07/27/06 22:14

Andy Hassall wrote:

> On Thu, 27 Jul 2006 17:47:50 -0400, Bob Stearns <rstearns1241@charter.net>
> wrote:
>
>
>>I have a variable v with the value -1. After v++ it has the value "" not
>>0. Since I am using it for a subscript, the "" value is not overwriting
>>the 0 element of the array as desired. Should v++ ever give a
>>non-numeric value?
>
>
> No - post a script and output demonstrating this?
>
> Since you're not on the latest release of a branch the standard advice would
> be "upgrade", though, if this actually happens.
>
Here is a script fragment and the debugging output therefrom:

dosql($sql, "S AUI 3", -1, "", $res, $n);
$debug .= "<br>stk_ptr=$stk_ptr; ";
while($x=odbc_fetch_array($res)) {
$debug .= "<br>x="; debug_var($x); $debug .= "<br>";
$item_list[$n_animals] = $x["ITEM_ID"];
$free = $x["FREE_PART"];
$free_list[$n_animals] = $free;
if($free!="Y") $chg_animals++;
$n_animals++;
$stk_ptr++;
$stack[$stack_ptr] = array($x["LOT_NUMB"], $x["LOT_SUFFIX"]);
$debug .= "<br>stk_ptr=$stkptr; stack=";
debug_var($stack);
$debug .= "<br>";

stk_ptr=-1;
x=array 14 { ITEM_ID=>29; AUCTION_ID=>21; BHID=>77143; LOT_NUMB=>11;
LOT_SUFFIX=>; SALE_ORDER=>; FOOTNOTES=>; CATALOG_UPDATE=>; COMMENTX=>;
PRINT_CATALOG=>Y; PART_OF_LOT_NUMB=>13; PART_OF_LOT_SUFFIX=>;
FREE_PART=>Y; CATEGORY=>; }


stk_ptr=; stack=array 2 { 0=>array 2 { 0=>13; 1=>; }
=>array 2 { 0=>11; 1=>; }
}

As you can see, stk_ptr is "", and so when it is used as a subscript,
stack[0] is not overwritten, which hangs the whole script in an infinite
loop.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация