ZF-8644: Zend_Validate_Sitemap reports valid W3C dates as invalid

Issue Type: Bug Created: 2009-12-27T12:59:46.000+0000 Last Updated: 2010-01-02T10:05:50.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Pádraic Brady (padraic) Assignee: Thomas Weidner (thomas) Tags: - Zend_Validate

Related issues: Attachments:


Zend_Validate_Sitemap_Lastmod does not correctly validate all W3C Datetime dates as allowed by the Sitemap specification.

<pre class="highlight">require_once 'Zend/Validate/Sitemap/Lastmod.php';

$v = new Zend_Validate_Sitemap_Lastmod;

var_dump($v->isValid("2009-12-27T20:49:30Z")); // FALSE
var_dump($v->isValid("2009-12-27T20:49:30+00:00")); // TRUE
var_dump($v->isValid("2009")); // FALSE
var_dump($v->isValid("2009-12")); // FALSE
var_dump($v->isValid("2009-12-27")); // TRUE
var_dump($v->isValid("2009-12-27T20:49:30+00:00")); // TRUE
var_dump($v->isValid("2009-12-27T20:49:30.30+00:00")); // FALSE

It looks like the regex is based on reading the Sitemap spec section alone without referring to the W3C spec.


Posted by Pádraic Brady (padraic) on 2009-12-27T13:05:35.000+0000

Adding correct component

Posted by Thomas Weidner (thomas) on 2010-01-02T10:05:50.000+0000

The standard is somewhat fuzzy related to the formats which are accepted.

Searching other resources it seems that only 3 formats from the 40 available W3C formats are accepted: 2007-08-25T00:00:00+00:00 2007-08-25T00:00+00:00 2007-08-25

Formats like "2009", "2009-01" or "11:00:00" are not valid.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.