Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: jrbasso/cakephp
...
head fork: jrbasso/cakephp
Checking mergeability… Don't worry, you can still create the pull request.
  • 14 commits
  • 13 files changed
  • 0 commit comments
  • 5 contributors
Commits on May 21, 2012
@jellehenkens jellehenkens Adding a validation rule for checking natural numbers 7546be6
Commits on May 22, 2012
@jellehenkens jellehenkens Adding an assert to check for zero prefixed numbers 7d080ea
Commits on May 23, 2012
@markstory markstory Update version number to 2.1.3 c26df70
@markstory markstory Remove bonus intval()
It caused issues when getting numeric keys that
exceeded PHP_INT_MAX.

Fixes #2897
5270721
@markstory markstory Fix incorrect return type. aa85451
Commits on May 24, 2012
@markstory markstory Set session.gc_maxlifetime by default.
In the default case of using files for sessions, files could
be garbage collected earlier than expected based on other session
settings.  Always set session.gc_maxlifetime so session files are
garbage collected correctly.

Fixes #2901
b27a3aa
@jellehenkens jellehenkens Fixing typo in the docblock f6a6e33
Commits on May 27, 2012
@markstory markstory Merge branch '2.1' into 2.2
Conflicts:
	lib/Cake/VERSION.txt
4b8c469
@AD7six AD7six allow loading namespaced classes
This permits, e.g.

App::uses('Ns\Foo', 'Plugin.Lib');
...
new Ns\Foo();
new \Ns\Foo(); // Or

to work
5bcb134
@markstory markstory Merge pull request #662 from jellehenkens/2.2-validation-natural-number
Adding validation rule for natural numbers
4485f59
@markstory markstory Fix coding standards error. 233e7d6
@markstory markstory Fix failing tests because of new validator. 9232df8
@markstory markstory Fix some minor code style issues. 1c0f97e
@jrbasso Merge remote-tracking branch 'cakephp/2.2' into 3.0-namespace cdadaee
View
4 lib/Cake/Core/App.php
@@ -582,8 +582,10 @@ public static function load($className) {
$paths[] = $pluginPath . 'Lib' . DS . $package . DS;
$paths[] = $pluginPath . $package . DS;
}
+
+ $normalizedClassName = str_replace('\\', DS, $className);
foreach ($paths as $path) {
- $file = $path . $className . '.php';
+ $file = $path . $normalizedClassName . '.php';
if (file_exists($file)) {
self::_map($file, $className, $plugin);
return include $file;
View
3  lib/Cake/Model/Datasource/Session.php
@@ -471,6 +471,9 @@ protected static function _configureSession() {
if (!empty($sessionConfig['handler'])) {
$sessionConfig['ini']['session.save_handler'] = 'user';
}
+ if (!isset($sessionConfig['ini']['session.gc_maxlifetime'])) {
+ $sessionConfig['ini']['session.gc_maxlifetime'] = $sessionConfig['timeout'] * 60;
+ }
if (empty($_SESSION)) {
if (!empty($sessionConfig['ini']) && is_array($sessionConfig['ini'])) {
View
2  lib/Cake/Network/Request.php
@@ -618,7 +618,7 @@ public function method() {
/**
* Get the host that the request was handled on.
*
- * @return void
+ * @return string
*/
public function host() {
return env('HTTP_HOST');
View
1  lib/Cake/Test/TestCase/Console/Command/Task/ExtractTaskTest.php
@@ -402,7 +402,6 @@ public function testExtractModelValidationInPlugin() {
$this->assertNotRegExp($pattern, $result);
}
-
/**
* Test that the extract shell overwrites existing files with the overwrite parameter
*
View
4 lib/Cake/Test/TestCase/Console/Command/Task/ModelTaskTest.php
@@ -315,7 +315,7 @@ public function testInteractiveFieldValidation() {
$this->Task->initValidations();
$this->Task->interactive = true;
$this->Task->expects($this->any())->method('in')
- ->will($this->onConsecutiveCalls('21', 'y', '17', 'n'));
+ ->will($this->onConsecutiveCalls('22', 'y', '17', 'n'));
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
$expected = array('notempty' => 'notempty', 'maxlength' => 'maxlength');
@@ -333,7 +333,7 @@ public function testInteractiveFieldValidationWithBogusResponse() {
$this->Task->interactive = true;
$this->Task->expects($this->any())->method('in')
- ->will($this->onConsecutiveCalls('999999', '21', 'n'));
+ ->will($this->onConsecutiveCalls('999999', '22', 'n'));
$this->Task->expects($this->at(7))->method('out')
->with($this->stringContains('make a valid'));
View
9 lib/Cake/Test/TestCase/Controller/Component/Auth/BasicAuthenticateTest.php
@@ -56,15 +56,6 @@ public function setUp() {
}
/**
- * tearDown
- *
- * @return void
- */
- public function tearDown() {
- parent::tearDown();
- }
-
-/**
* test applying settings in the constructor
*
* @return void
View
2  lib/Cake/Test/TestCase/Model/Datasource/CakeSessionTest.php
@@ -737,6 +737,8 @@ public function testCookieTimeoutFallback() {
TestCakeSession::start();
$this->assertEquals(400, Configure::read('Session.cookieTimeout'));
$this->assertEquals(400, Configure::read('Session.timeout'));
+ $this->assertEquals(400 * 60, ini_get('session.cookie_lifetime'));
+ $this->assertEquals(400 * 60, ini_get('session.gc_maxlifetime'));
$_SESSION = null;
Configure::write('Session', array(
View
2  lib/Cake/Test/TestCase/Model/ModelWriteTest.php
@@ -241,7 +241,7 @@ public function testCacheClearOnSave() {
$data = array(
'OverallFavorite' => array(
'id' => 22,
- 'model_type' => '8-track',
+ 'model_type' => '8-track',
'model_id' => '3',
'priority' => '1'
)
View
9 lib/Cake/Test/TestCase/Model/Validator/CakeValidationSetTest.php
@@ -27,15 +27,6 @@
class CakeValidationSetTest extends CakeTestCase {
/**
- * setUp method
- *
- * @return void
- */
- public function setUp() {
- parent::setUp();
- }
-
-/**
* testValidate method
*
* @return void
View
14 lib/Cake/Test/TestCase/Utility/SetTest.php
@@ -1618,6 +1618,20 @@ public function testClassicExtract() {
}
/**
+ * test classicExtract with keys that exceed 32bit max int.
+ *
+ * @return void
+ */
+ public function testClassicExtractMaxInt() {
+ $data = array(
+ 'Data' => array(
+ '13376924712' => 'abc'
+ )
+ );
+ $this->assertEquals('abc', Set::classicExtract($data, 'Data.13376924712'));
+ }
+
+/**
* testInsert method
*
* @see Hash tests, as Set::insert() is just a proxy.
View
21 lib/Cake/Test/TestCase/Utility/ValidationTest.php
@@ -1964,6 +1964,27 @@ public function testNumeric() {
}
/**
+ * testNaturalNumber method
+ *
+ * @return void
+ */
+ public function testNaturalNumber() {
+ $this->assertFalse(Validation::naturalNumber('teststring'));
+ $this->assertFalse(Validation::naturalNumber('5.4'));
+ $this->assertFalse(Validation::naturalNumber(99.004));
+ $this->assertFalse(Validation::naturalNumber('0,05'));
+ $this->assertFalse(Validation::naturalNumber('-2'));
+ $this->assertFalse(Validation::naturalNumber(-2));
+ $this->assertFalse(Validation::naturalNumber('0'));
+ $this->assertFalse(Validation::naturalNumber('050'));
+
+ $this->assertTrue(Validation::naturalNumber('2'));
+ $this->assertTrue(Validation::naturalNumber(49));
+ $this->assertTrue(Validation::naturalNumber('0', true));
+ $this->assertTrue(Validation::naturalNumber(0, true));
+ }
+
+/**
* testPhone method
*
* @return void
View
4 lib/Cake/Utility/Set.php
@@ -562,8 +562,8 @@ public static function classicExtract($data, $path = null) {
foreach ($path as $i => $key) {
if (is_numeric($key) && intval($key) > 0 || $key === '0') {
- if (isset($data[intval($key)])) {
- $data = $data[intval($key)];
+ if (isset($data[$key])) {
+ $data = $data[$key];
} else {
return null;
}
View
13 lib/Cake/Utility/Validation.php
@@ -565,6 +565,19 @@ public static function numeric($check) {
}
/**
+ * Checks if a value is a natural number.
+ *
+ * @param string $check Value to check
+ * @param boolean $allowZero Set true to allow zero, defaults to false
+ * @return boolean Success
+ * @see http://en.wikipedia.org/wiki/Natural_number
+ */
+ public static function naturalNumber($check, $allowZero = false) {
+ $regex = $allowZero ? '/^(?:0|[1-9][0-9]*)$/' : '/^[1-9][0-9]*$/';
+ return self::_check($check, $regex);
+ }
+
+/**
* Check that a value is a valid phone number.
*
* @param string|array $check Value to check (string or array)

No commit comments for this range

Something went wrong with that request. Please try again.