Alexander Nazarov (nfokz) wrote in changelog,
Alexander Nazarov
nfokz
changelog

[livejournal] r21449: LJSUP-11559: Fix get parameters without ...

Committer: anazarov
LJSUP-11559: Fix get parameters without values
U   trunk/cgi-bin/LJ/Request/Apache2.pm
Modified: trunk/cgi-bin/LJ/Request/Apache2.pm
===================================================================
--- trunk/cgi-bin/LJ/Request/Apache2.pm	2012-03-19 11:28:27 UTC (rev 21448)
+++ trunk/cgi-bin/LJ/Request/Apache2.pm	2012-03-19 11:39:09 UTC (rev 21449)
@@ -407,12 +407,15 @@
     my $r = $class->r();
     if (wantarray()){
         my $qs = $r->args(@_);
-        my @args =
-            map { URI::Escape::uri_unescape ($_) }
-            map { s/\+/ /g; $_ } # in query_string 'break' is encoded as '+' simbol
-            map { split /=/ => $_, 2 }
-            split /[\&\;]/ => $qs;
-        return @args;
+        my @args = split /[&;]/ => $qs;
+        return map {
+            my ($k, $v) = map {
+                s{\+} { }g; # in query_string 'break' is encoded as '+' simbol
+                URI::Escape::uri_unescape($_)
+            } split '=', $_, 2;
+
+            defined $k? ($k, $v) : ();
+        } @args;
     } else {
         return $r->args(@_);
     }

Tags: anazarov, livejournal, nfokz, pm
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments