public function testAnyDeepLvl() { $scope = array('foo' => array('foo' => array('foo' => '@bar')), 'bar' => array('@bar' => array('bar' => "foo[]я")), 'fo' => array(array('o', 'ba', 'r'))); $this->assertEquals(array('foo[foo][foo]' => '@bar', 'bar[@bar][bar]' => 'foo[]я', 'fo[0][0]' => 'o', 'fo[0][1]' => 'ba', 'fo[0][2]' => 'r'), UrlParamsUtils::toParamsList($scope)); $this->assertEquals('foo[foo][foo]=%40bar&bar[%40bar][bar]=foo%5B%5D%D1%8F&fo[0][0]=o&fo[0][1]=ba&fo[0][2]=r', UrlParamsUtils::toString($scope)); }
private function getPostFields(HttpRequest $request) { if ($request->hasBody()) { return $request->getBody(); } else { if ($this->oldUrlConstructor) { return UrlParamsUtils::toStringOneDeepLvl($request->getPost()); } else { $fileList = array_map(array($this, 'fileFilter'), UrlParamsUtils::toParamsList($request->getFiles())); if (empty($fileList)) { return UrlParamsUtils::toString($request->getPost()); } else { $postList = UrlParamsUtils::toParamsList($request->getPost()); if (!is_null($atParam = $this->findAtParamInPost($postList))) { throw new NetworkException('Security excepion: not allowed send post param ' . $atParam . ' which begins from @ in request which contains files'); } return array_merge($postList, $fileList); } } } }