/opt/alt/php54/usr/share/pear/Symfony/Component/Form
NameSizeModeActions
Exception/-0755rm
Extension/-0755rm
Guess/-0755rm
Resources/-0755rm
Test/-0755rm
Util/-0755rm
AbstractExtension.php48850644editdlrm
AbstractRendererEngine.php76340644editdlrm
AbstractType.php10800644editdlrm
AbstractTypeExtension.php9930644editdlrm
autoloader.php3340644editdlrm
Button.php88260644editdlrm
ButtonBuilder.php185230644editdlrm
ButtonTypeInterface.php4620644editdlrm
CallbackTransformer.php21380644editdlrm
ClickableInterface.php5590644editdlrm
DataMapperInterface.php11300644editdlrm
DataTransformerInterface.php31590644editdlrm
Form.php348650644editdlrm
FormBuilder.php78710644editdlrm
FormBuilderInterface.php23350644editdlrm
FormConfigBuilder.php216800644editdlrm
FormConfigBuilderInterface.php86660644editdlrm
FormConfigInterface.php64370644editdlrm
FormError.php25630644editdlrm
FormEvent.php12470644editdlrm
FormEvents.php11400644editdlrm
FormExtensionInterface.php16680644editdlrm
FormFactory.php52250644editdlrm
FormFactoryBuilder.php36090644editdlrm
FormFactoryBuilderInterface.php30580644editdlrm
FormFactoryInterface.php42440644editdlrm
FormInterface.php83280644editdlrm
FormRegistry.php47530644editdlrm
FormRegistryInterface.php14420644editdlrm
FormRenderer.php119540644editdlrm
FormRendererEngineInterface.php70630644editdlrm
FormRendererInterface.php32790644editdlrm
Forms.php58990644editdlrm
FormTypeExtensionInterface.php21250644editdlrm
FormTypeGuesserChain.php28800644editdlrm
FormTypeGuesserInterface.php21700644editdlrm
FormTypeInterface.php32220644editdlrm
FormView.php35240644editdlrm
NativeRequestHandler.php56120644editdlrm
PreloadedExtension.php23170644editdlrm
RequestHandlerInterface.php6680644editdlrm
ResolvedFormType.php76620644editdlrm
ResolvedFormTypeFactory.php6580644editdlrm
ResolvedFormTypeFactoryInterface.php13020644editdlrm
ResolvedFormTypeInterface.php33070644editdlrm
ReversedTransformer.php12560644editdlrm
SubmitButton.php11370644editdlrm
SubmitButtonBuilder.php6240644editdlrm
SubmitButtonTypeInterface.php4740644editdlrm
Edit: /opt/alt/php54/usr/share/pear/Symfony/Component/Form/NativeRequestHandler.php (5612B)
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form; use Symfony\Component\Form\Exception\UnexpectedTypeException; /** * A request handler using PHP's super globals $_GET, $_POST and $_SERVER. * * @author Bernhard Schussek */ class NativeRequestHandler implements RequestHandlerInterface { /** * The allowed keys of the $_FILES array. * * @var array */ private static $fileKeys = array( 'error', 'name', 'size', 'tmp_name', 'type', ); /** * {@inheritdoc} */ public function handleRequest(FormInterface $form, $request = null) { if (null !== $request) { throw new UnexpectedTypeException($request, 'null'); } $name = $form->getName(); $method = $form->getConfig()->getMethod(); if ($method !== self::getRequestMethod()) { return; } if ('GET' === $method) { if ('' === $name) { $data = $_GET; } else { // Don't submit GET requests if the form's name does not exist // in the request if (!isset($_GET[$name])) { return; } $data = $_GET[$name]; } } else { $fixedFiles = array(); foreach ($_FILES as $name => $file) { $fixedFiles[$name] = self::stripEmptyFiles(self::fixPhpFilesArray($file)); } if ('' === $name) { $params = $_POST; $files = $fixedFiles; } elseif (array_key_exists($name, $_POST) || array_key_exists($name, $fixedFiles)) { $default = $form->getConfig()->getCompound() ? array() : null; $params = array_key_exists($name, $_POST) ? $_POST[$name] : $default; $files = array_key_exists($name, $fixedFiles) ? $fixedFiles[$name] : $default; } else { // Don't submit the form if it is not present in the request return; } if (is_array($params) && is_array($files)) { $data = array_replace_recursive($params, $files); } else { $data = $params ?: $files; } } // Don't auto-submit the form unless at least one field is present. if ('' === $name && count(array_intersect_key($data, $form->all())) <= 0) { return; } $form->submit($data, 'PATCH' !== $method); } /** * Returns the method used to submit the request to the server. * * @return string The request method. */ private static function getRequestMethod() { $method = isset($_SERVER['REQUEST_METHOD']) ? strtoupper($_SERVER['REQUEST_METHOD']) : 'GET'; if ('POST' === $method && isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) { $method = strtoupper($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']); } return $method; } /** * Fixes a malformed PHP $_FILES array. * * PHP has a bug that the format of the $_FILES array differs, depending on * whether the uploaded file fields had normal field names or array-like * field names ("normal" vs. "parent[child]"). * * This method fixes the array to look like the "normal" $_FILES array. * * It's safe to pass an already converted array, in which case this method * just returns the original array unmodified. * * This method is identical to {@link Symfony\Component\HttpFoundation\FileBag::fixPhpFilesArray} * and should be kept as such in order to port fixes quickly and easily. * * @param array $data * * @return array */ private static function fixPhpFilesArray($data) { if (!is_array($data)) { return $data; } $keys = array_keys($data); sort($keys); if (self::$fileKeys !== $keys || !isset($data['name']) || !is_array($data['name'])) { return $data; } $files = $data; foreach (self::$fileKeys as $k) { unset($files[$k]); } foreach (array_keys($data['name']) as $key) { $files[$key] = self::fixPhpFilesArray(array( 'error' => $data['error'][$key], 'name' => $data['name'][$key], 'type' => $data['type'][$key], 'tmp_name' => $data['tmp_name'][$key], 'size' => $data['size'][$key] )); } return $files; } /** * Sets empty uploaded files to NULL in the given uploaded files array. * * @param mixed $data The file upload data. * * @return array|null Returns the stripped upload data. */ private static function stripEmptyFiles($data) { if (!is_array($data)) { return $data; } $keys = array_keys($data); sort($keys); if (self::$fileKeys === $keys) { if (UPLOAD_ERR_NO_FILE === $data['error']) { return null; } return $data; } foreach ($data as $key => $value) { $data[$key] = self::stripEmptyFiles($value); } return $data; } }