Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 1.2.2, 1.2.3
-
Fix Version/s: None
-
Component/s: Validators
-
Labels:None
-
Environment:Debian Lenny (5.0.8) with MySQL (5.0.51a-24+lenny5O). Doctrine hosted within CodeIgniter v1.7.2
Description
Since April last year I've been unable to use Doctrine Timestampable functionality because I get errors like this:
Uncaught exception 'Doctrine_Validator_Exception' with message 'Validation failed in class XXX 1 field had validation error: * 1 validator failed on created_at (unsigned) ' in ...
I've tried lots of different configurations for the timestampable functionality (see my Stack Overflow question for details) to no avail.
I've done some further investigation and the reason for the problem is that the timestamps are being sent to Doctrine_Validator_Unsigned for validation; they are then failing the following regexp test:
if (preg_match('/[^0-9\-\.]/', $value)) { return false; }
I'm not smart enough to figure out why Doctrine is calling an unsigned validation test for these timestamps, so for now I've fixed the problem by hacking the following into Doctrine_Validator_Unsigned:
if (preg_match('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $value)) { return true; }
Very ugly I know, but when I add this in the rest of the timestamping functionality works perfectly. Would love to get to the bottom of this bug - is particularly strange because nobody else seems to be experiencing it.
Added CodeIgniter details to environment