Browse Source

Only parse URLs when they contain ://

Parsing incomplete URLs fails in PHP5.2.
mark_story 12 years ago
parent
commit
51909ae738
1 changed files with 6 additions and 4 deletions
  1. 6 4
      lib/Cake/View/Helper/FormHelper.php

+ 6 - 4
lib/Cake/View/Helper/FormHelper.php

@@ -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;
 	}