laminas / laminas-feed

Consume and generate Atom and RSS feeds, and interact with Pubsubhubbub.
https://docs.laminas.dev/laminas-feed/
BSD 3-Clause "New" or "Revised" License
146 stars 26 forks source link

An item should not include both author and dc:creator #4

Open weierophinney opened 4 years ago

weierophinney commented 4 years ago

Using the W3C Feed Validation Service:

In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendations.
line 19, column 6: An item should not include both author and dc:creator (10 occurrences) [help]

      <dc:creator>Tina "jnienow" Pfannerstill</dc:creator>

Code to reproduce the issue

n/a

Expected results

Only one of author and dc:creator is included.

Actual results

Both are included.


Originally posted by @glen-84 at https://github.com/zendframework/zend-feed/issues/90

weierophinney commented 4 years ago

@glen-84 One option is to remove (deregister) the core extension DublinCore\Renderer\Feed from extension manager, but I think there was a problem.

We then have to check as well:

I will have a deeper look into the code. Thanks for reporting!


Originally posted by @froschdesign at https://github.com/zendframework/zend-feed/issues/90#issuecomment-427017392

weierophinney commented 4 years ago

I think we must change the method Zend\Writer\Writer::registerCoreExtensions:

public static function registerCoreExtensions()
{
    $coreExtensions = [
        'Atom',
        'Content',
        'DublinCore',
        'GooglePlayPodcast',
        'ITunes',
        'Slash',
        'Threading',
        'WellFormedWeb',
    ];

    foreach ($coreExtensions as $coreExtension) {
        if (static::hasExtension($coreExtension)) {
            static::registerExtension($coreExtension);
        }
    }
}

With this change an extension can be removed (deregister):

$extensionManager = new Zend\Feed\Writer\StandaloneExtensionManager();
$extensionManager->remove('DublinCore\Renderer\Entry');
$extensionManager->remove('DublinCore\Renderer\Feed');
Zend\Feed\Writer\Writer::setExtensionManager($extensionManager);

@glen-84 Can you test this idea? Thanks in advance!


Originally posted by @froschdesign at https://github.com/zendframework/zend-feed/issues/90#issuecomment-469418069

weierophinney commented 4 years ago

@froschdesign,

It does seem to work, but shouldn't this be the default? (i.e. by default it shouldn't include both elements?)


Originally posted by @glen-84 at https://github.com/zendframework/zend-feed/issues/90#issuecomment-470854861

weierophinney commented 4 years ago

@glen-84 Thanks for your feedback! I will create a patch for it.

… by default it shouldn't include both elements?

It was implemented in zend-feed before 2012 and I do not know if there was already a recommendation for this elements to that time. At the current point it is an BC break to change the current behaviour but we need a option to customize it.


Originally posted by @froschdesign at https://github.com/zendframework/zend-feed/issues/90#issuecomment-470863494

cmegd commented 2 months ago

I'm facing the same issue, are there any plans to fix this?

froschdesign commented 2 months ago

@cmegd There will definitely be an update, but there is no fixed time frame for this. Any help is welcome! So create a pull request and I will review it. 👍🏻