Przeglądaj źródła

Support multipart/form-data post array

https://github.com/walkor/webman/issues/256?notification_referrer_id=NT_kwDOAFysGLIyNzU5NjI2ODIxOjYwNzMzNjg
walkor 3 lat temu
rodzic
commit
39a2a54bbc
1 zmienionych plików z 7 dodań i 1 usunięć
  1. 7 1
      Protocols/Http/Request.php

+ 7 - 1
Protocols/Http/Request.php

@@ -546,7 +546,13 @@ class Request
                         else {
                             // Parse $_POST.
                             if (\preg_match('/name="(.*?)"$/', $header_value, $match)) {
-                                $this->_data['post'][$match[1]] = $boundary_value;
+                                $key = $match[1];
+                                if (\strlen($key) > 2 && \substr($key, -2) == '[]') {
+                                    $key = \substr($key, 0, -2);
+                                    $this->_data['post'][$key][] = $boundary_value;
+                                } else {
+                                    $this->_data['post'][$key] = $boundary_value;
+                                }
                             }
                         }
                         break;