A warning was thrown because of the preg_match call, as not every input
is a string we prevent calls from arrays going further into checking.
Issue 346
A warning was thrown because of the preg_match call, as not every input
is a string we prevent calls from arrays going further into checking.
Issue 346
A warning was thrown because of the preg_match call, as not every input
is a string we prevent calls from arrays going further into checking.
Issue 346
timezone information. However, in the comparison the DateTime-object is
first output to a timestamp, which is then converted to a string with the
date()-function. But because a timestamp does not include timezone
information, date() will assume the system's timezone. So if the system
timezone set in the PHP settings is UTC, a string with another timezone,
e.g. 2015-04-24T21:11:00+02:00, will fail to be validated. The result from
the date()-function in this example is 2015-04-24T19:11:00+00:00, which is
a different string then the input.
The DateTime-class has also an option to create a string from a format,
DateTime->format(). So it is possible to skip the use of the
date()-function with the added benefit that using format() does have
access to the timezone information and thus produces the expected
2015-04-24T21:11:00+02:00 to compare with the given input.
This commit changes the Rule to accommodate this and expands the tests. If
these added tests are run before applying the fix to the Date-rule, the
tests will fail.
There are some other rules which could extend this class too, like Tld
and CountryCode, but was not changed in order to avoid code duplication
or API breaks.
We have the "Int" rule but "int" is reserved word in PHP 7, so, until we
rename this rule - which will be just on our first major release -, we
will have no support for this version of PHP.