Only parse URLs when they contain ://

Parsing incomplete URLs fails in PHP5.2.
This commit is contained in:
mark_story 2014-05-09 17:01:22 -04:00
parent 5469840c80
commit 51909ae738

View file

@ -466,11 +466,13 @@ class FormHelper extends AppHelper {
$this->setEntity($model, true);
$this->_introspectModel($model, 'fields');
}
$query = parse_url($action, PHP_URL_QUERY);
if ($query) {
$query = '?' . $query;
$this->_lastAction = $action;
if (strpos($action, '://')) {
$query = parse_url($action, PHP_URL_QUERY);
$query = $query ? '?' . $query : '';
$this->_lastAction = parse_url($action, PHP_URL_PATH) . $query;
}
$this->_lastAction = parse_url($action, PHP_URL_PATH) . $query;
return $this->Html->useTag('form', $action, $htmlAttributes) . $append;
}