On Wed, 26 Oct 2005, Benjamin Franz wrote:
On Tue, 25 Oct 2005, Dave Rolsky wrote:
On Wed, 19 Oct 2005, Benjamin Franz wrote:
Line 877 of HTML/Mason/ApacheHandler.pm does a numeric comparison of
$retval with 200 without checking that it is defined or even a number
first. This can generate "Use of uninitialized value in numeric eq (==)"
in the Apache error_log in some configurations (specifically in
Bricolage).
The attached patch against 1.3101 checks that $retval is defined and uses
a string comparison vice a numeric comparision to check if it is a code
'200' to silence the warning.
Checking defined-ness makes sense, but why would we want to switch that to
a string comparison?
It handles the potential case of somewhere, someone, sometime reifying undef
as '' (say via something like $retval = defined($retval) ? $retval : '';) and
prevents Argument "" isn't numeric in numeric eq (==) warnings at that line
if that were to ever happen.
It really doesn't make sense to thinks of HTTP codes as actual numbers: They
can't be safely used in *any* arithmetic operations other than equality
tests. They are really just string constants that look a lot like numbers.
Using string comparisions vice numeric comparisions eliminates a class of
errors caused by thinking of them as actual numbers.
I just (belatedly) got around to look back at this and this makes sense.
I checked in a change for this which will be in 1.32.
-dave
/*===================================================
VegGuide.Org www.BookIRead.com
Your guide to all that's veg. My book blog
===================================================*/
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users