ID: 32584 Updated by: [EMAIL PROTECTED] Reported By: xsmokex at chello dot at -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Windows 2003 Server PHP Version: 5.0.3 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php No bug here, $idx & $idxcnt are just in the different scope. Use error_reporting(E_ALL) to turn on notices and read the documentation more carefully. Previous Comments: ------------------------------------------------------------------------ [2005-04-05 11:22:17] xsmokex at chello dot at sorry didnt know u need it for tests in that way here you have the requested sample (no additional things needed just run it) SCRIPT: <?php $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; } //the Test (should normally return echo "index field";) if (!isidx("kunden___Kunden_Nr")) { //not a indexfield echo "not a index field"; } else { echo "index field"; } ?> ------------------------------------------------------------------------ [2005-04-05 11:02:15] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try to avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2005-04-05 10:51:56] xsmokex at chello dot at 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 this bug report at http://bugs.php.net/?id=32584&edit=1