'return' crash on Mac OS X Server with PHP 4.0b3
| From: | Jon Jensen | Date: | Sat, 12 Feb 2000 18:39:18 +0000 |
| Subject: | 'return' crash on Mac OS X Server with PHP 4.0b3 | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-10187@lists.php.net to get a copy of this message | ||
I've gotten PHP 4.0b3 to work with Apache 1.3.11 on Mac OS X Server, but
there's a mysterious bug. With the 'square' function example in the
manual:
function square ($num) {
return $num * $num;
}
echo square(4);
It works fine with PHP 3.0.12. But 4.0b3 crashes with a 'document
contained no data' error to the browser. (I've tested it under Red Hat 6.1
and it works fine in both versions.) However, if I change the code to
this:
function square ($num) {
$val = $num * $num;
return $val;
}
echo square(4);
It works fine.
The only change I had to make to get PHP 4.0b3 to compile under Mac OS X
Server was to change line 232 of php.h from:
#if (!HAVE_SNPRINTF)
to
#ifndef HAVE_SNPRINTF
I don't know much about the C preprocessor, but it seems to make sense and
another guy who ported 3.0.11 did the same thing. However, maybe that's
the problem. The original code causes a 'parse error', thus the need for a
change.
Does anyone know why that 'return' isn't working? These also fail:
return "$j like $b";
return $j . $b;
I've never used gdb (or any other debugger) but am willing to learn if
it'll help.
Jon Jensen