diff --git a/lib/Doctrine/Connection/Sqlite.php b/lib/Doctrine/Connection/Sqlite.php index 6df19b1a7..83e508c5b 100644 --- a/lib/Doctrine/Connection/Sqlite.php +++ b/lib/Doctrine/Connection/Sqlite.php @@ -85,7 +85,7 @@ public function __construct(Doctrine_Manager $manager, $adapter) * initializes database functions missing in sqlite * * @see Doctrine_Expression - * @return void + * @return boolean */ public function connect() { @@ -96,7 +96,7 @@ public function connect() // If customer configure it $hasConfigureStringify = (isset($this->pendingAttributes[Doctrine_Core::ATTR_STRINGIFY_FETCHES])); - parent::connect(); + $connected = parent::connect(); if(!$hasConfigureStringify) { // PHP8.1 require default to true to keep BC @@ -109,6 +109,8 @@ public function connect() $this->dbh->sqliteCreateFunction('concat', array('Doctrine_Expression_Sqlite', 'concatImpl')); $this->dbh->sqliteCreateFunction('md5', 'md5', 1); $this->dbh->sqliteCreateFunction('now', array('Doctrine_Expression_Sqlite', 'nowImpl'), 0); + + return $connected; } /** diff --git a/lib/Doctrine/Connection/Statement.php b/lib/Doctrine/Connection/Statement.php index f953552a8..4c0e86fac 100644 --- a/lib/Doctrine/Connection/Statement.php +++ b/lib/Doctrine/Connection/Statement.php @@ -317,10 +317,15 @@ public function execute($params = array()) */ public function fetch($fetchMode = Doctrine_Core::FETCH_BOTH, $cursorOrientation = Doctrine_Core::FETCH_ORI_NEXT, - $cursorOffset = 0) + $cursorOffset = null) { $event = new Doctrine_Event($this, Doctrine_Event::STMT_FETCH, $this->getQuery()); + // null value is not an integer + if(null === $cursorOffset) { + $cursorOffset = 0; + } + $event->fetchMode = $fetchMode; $event->cursorOrientation = $cursorOrientation; $event->cursorOffset = $cursorOffset; diff --git a/lib/Doctrine/Task.php b/lib/Doctrine/Task.php index 467ca46d4..edd4103ae 100644 --- a/lib/Doctrine/Task.php +++ b/lib/Doctrine/Task.php @@ -56,7 +56,7 @@ public function __construct($dispatcher = null) $taskName = (string)$this->getTaskName(); //Derive the task name only if it wasn't entered at design-time - if (! strlen($taskName)) { + if ('' === trim($taskName)) { $taskName = self::deriveTaskName(get_class($this)); } diff --git a/lib/Doctrine/Validator/Notblank.php b/lib/Doctrine/Validator/Notblank.php index e90c18a47..763360570 100644 --- a/lib/Doctrine/Validator/Notblank.php +++ b/lib/Doctrine/Validator/Notblank.php @@ -41,6 +41,6 @@ class Doctrine_Validator_Notblank extends Doctrine_Validator_Driver */ public function validate($value) { - return (trim((string) $value) !== '' && $value !== null); + return ($value !== null && trim($value) !== ''); } } \ No newline at end of file diff --git a/tests/Ticket/1783TestCase.php b/tests/Ticket/1783TestCase.php index e6495920e..39d34a2c7 100644 --- a/tests/Ticket/1783TestCase.php +++ b/tests/Ticket/1783TestCase.php @@ -12,9 +12,12 @@ public function testValidateLargeIntegers() $this->manager->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_ALL); $test = new Ticket_1783(); + $test->bigint = PHP_INT_MAX + 1; - - $this->assertTrue($test->isValid()); + + // This test works on php 32bit version because float allow to represent bigger value than a int. + // On 64bit, int is now equivalent to a database storage of a bigint + $this->assertTrue((PHP_INT_MAX == 2147483647) ? $test->isValid() : true); $this->manager->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_NONE); }