Package: php4
Version: 4:4.3.10-15
Severity: minor
From: http://nl3.php.net/foreach:
"(...) foreach works only on arrays, and will issue an error when you
try to use it on a variable with a different data type or an
uninitialized variable. (...)"
Well, on my Debian-testing server, PHP does not issue a warning when I
pass a var to foreach which isn't an array.
For example the following code will not output a warning with
error_reporting(EALL):
$res = NULL;
foreach ($res as $key => $value) {
echo $key . "<br />";
}
It DOES generate a warning on my W32-machine with PHP 4.3.11 installed.
To circumvent the warning on W32 I have to write the following code:
$res = NULL;
if (!is_null($res)) {
foreach ($res as $key => $value) {
echo $key . "<br />";
}
}
And this should be done on Debian too.
Regards,
Patrick
-- System Information:
Debian Release: 3.1
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.4.27-2-386
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Versions of packages php4 depends on:
ii libapache-mod-php4 4:4.3.10-15 server-side, HTML-embedded scripti
ii php4-common 4:4.3.10-15 Common files for packages built fr
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]