hi guys...

   Lyle brought this to my attention during some other offline discussions this 
afternoon.

   apparently, under mod_perl 1.3, $r->args(undef) doesn't work properly.  to test, 
just 
add this line to your httpd.conf:

   PerlInitHandler 'sub {shift->args(undef); return 0}'

and try accessing mod_info.  mod_info has lots of if (!r->args) logic in it, so 
undef()ing 
$r->args could be a legitimate thing to want to do to (and DWIMmy) as well.

the below simple patch fixes the problem.

I'm not sure, though, if this isn't a more pervasive bug for other request_rec fields. 
 I 
added some trace statements in Apache.xs and it seems that even if $val is undef that 
ST(1) in query_string() in still defined.  furthermore, perl throws "Use of 
uninitialized 
value in subroutine entry at 
/src/bleedperl/lib/site_perl/5.7.3/i686-linux-thread-multi/Apache.pm"

my guess here is that perl is interpreting $val as 0 or "" (per perldiag), which is 
defined, and thus get_set_PVp() is thrown off and r->args is never set to NULL.  it 
almost 
seems like a Perl bug if this analysis is right (or at least something to keep in mind 
per 
XS relationships)

anyway, as I said, the below patch fixes $r->args().  does anyone think this is an 
issue 
elsewhere as well?  in either case, this probably deserves a test case under t/ (which 
I'll work on if folks agree this is legitimate).

--Geoff

--- Apache/Apache.pm    16 May 2002 15:21:46 -0000      1.71
+++ Apache/Apache.pm    28 May 2002 19:38:41 -0000
@@ -58,7 +58,7 @@

  sub args {
      my($r, $val) = @_;
-    my $args = @_ > 1 ? $r->query_string($val) : $r->query_string;
+    my $args = @_ > 1 ? $r->query_string($val||undef) : $r->query_string;
      return $args unless wantarray;
      parse_args(1, $args);
  }


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to