#32584 [NEW]: count() doesnt work in some cases
| From: | xsmokex at chello dot at | Date: | Tue, 05 Apr 2005 08:51:57 +0000 |
| Subject: | #32584 [NEW]: count() doesnt work in some cases | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-76365@lists.php.net to get a copy of this message | ||
From: xsmokex at chello dot at
Operating system: Windows 2003 Server
PHP version: 5.0.3
PHP Bug Type: Scripting Engine problem
Bug description: count() doesnt work in some cases
Description:
------------
count just stops returning any values inside my function
outside it returns the value it should quite dissapointing bug :/
Reproduce code:
---------------
$idxsplit = "kunden___Kunden_Nr,kunden___Zuname";
$idx = explode(",",$idxsplit); //Index Felder
$idxcnt = count($idx);
echo $idxcnt;
//Aktives Feld Index Feld?
function isidx($obj) {
echo $obj;
$retval = 0;
if ($obj != "") {
echo "obj";
echo $idxcnt;
echo "test";
for ($i = 0; $i < $idxcnt; $i++) {
echo $idx[$i];
if ($idx[$i] == $obj) {
$retval = 1;
break;
}
}
}
echo $idxcnt;
echo "ende".$retval;
return $retval;
}
//Erster Satz
if ($kunden___speichern == "mer") {
if (isidx($kunden___AKTFLD)) { //kunden___Kunden_Nr/kunden___Zuname
Expected result:
----------------
well runing isidx() with $kunden___AKTFLD(value:kunden___Kunden_Nr or
kunden___Zuname ....)
returning true/false if the current selected field is a indexed field
Actual result:
--------------
the echo returnings:
2kunden___Kunden_Nrobjtestende0
Broken down:
outside function:
2: echo $idxcnt;
inside function:
kunden___Kunden: echo $obj;
obj: echo "obj";
: echo $idxcnt; //no value returned
test echo "test";
: echo $idx[$i]; //dont get into due no value from $idxcnt
: echo $idxcnt; //no value returned
ende0 echo "ende".$retval;
--
Edit bug report at http://bugs.php.net/?id=32584&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32584&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32584&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32584&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32584&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32584&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32584&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32584&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32584&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32584&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32584&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32584&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32584&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32584&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32584&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32584&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32584&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32584&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32584&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32584&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32584&r=mysqlcfg