Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch '1.3' into 1.3-misc

  • Loading branch information...
commit 49e95504829c271ef2a3c01bf3b635cda3e9ed06 2 parents b377905 + 32683d3
@markstory markstory authored
View
2  cake/libs/validation.php
@@ -549,7 +549,7 @@ function extension($check, $extensions = array('gif', 'jpeg', 'png', 'jpg')) {
*/
function ip($check, $type = 'IPv4') {
if (function_exists('filter_var')) {
- return filter_var($check, FILTER_VALIDATE_IP);
+ return (boolean) filter_var($check, FILTER_VALIDATE_IP);
}
$_this =& Validation::getInstance();
View
5 cake/libs/view/helpers/prototype_engine.php
@@ -234,13 +234,12 @@ function request($url, $options = array()) {
$type = '.Updater';
unset($options['update'], $options['type']);
}
- $safe = array();
+ $safe = array_keys($this->_callbackArguments['request']);
+ $options = $this->_prepareCallbacks('request', $options, $safe);
if (isset($options['dataExpression'])) {
$safe[] = 'parameters';
unset($options['dataExpression']);
}
- $safe = array_merge($safe, array_keys($this->_callbackArguments['request']));
- $options = $this->_prepareCallbacks('request', $options, $safe);
$options = $this->_parseOptions($options, $safe);
if (!empty($options)) {
$options = ', {' . $options . '}';
View
11 cake/tests/cases/libs/view/helpers/prototype_engine.test.php
@@ -247,6 +247,17 @@ function testRequest() {
));
$expected = 'var jsRequest = new Ajax.Request("/people/edit/1", {asynchronous:false, method:"post", onComplete:function (transport) {doComplete();}, onCreate:function (transport) {doBefore();}, onFailure:function (response, jsonHeader) {handleError();}, onSuccess:function (response, jsonHeader) {doSuccess();}});';
$this->assertEqual($result, $expected);
+
+ $this->Proto->get('#submit');
+ $result = $this->Proto->request('/users/login', array(
+ 'before' => 'login.create(event)',
+ 'complete' => 'login.complete(event)',
+ 'update' => 'auth',
+ 'data' => $this->Proto->serializeForm(array('isForm' => false, 'inline' => true)),
+ 'dataExpression' => true
+ ));
+ $this->assertTrue(strpos($result, '$($("submit").form).serialize()') > 0);
+ $this->assertFalse(strpos($result, 'parameters:function () {$($("submit").form).serialize()}') > 0);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.