Issues

ZF-12453: Zend_Feed_Writer_Feed addAuthor() throwing exceptions

Issue Type: Bug Created: 2012-10-23T18:21:16.000+0000 Last Updated: 2012-11-06T21:02:22.000+0000 Status: Resolved Fix version(s): - 1.12.1 (18/Dec/12)

Reporter: bullfrogblues (gerardroche) Assignee: Frank Brückner (frosch) Tags: - Zend_Feed_Writer

  • FixForZF1.12.1

Related issues: Attachments: - Entry.php.patch

Description

Fatal error: Uncaught exception 'Zend_Feed_Exception' with message 'Invalid parameter: "name" must be a non-empty string value' ../library/Zend/Feed/Writer/Feed/FeedAbstract.php on line 122.

Once that's fixed we get another exception:

Fatal error: Uncaught exception 'Zend_Feed_Exception' with message 'Invalid parameter: "name" must be a non-empty string value' in ../library/Zend/Feed/Writer/Entry.php on line 119

This is due to code that won't ever work.

Patch

Change line 120 in Zend_Feed_Writer_Feed_FeedAbstract to:

<pre class="highlight">
if (empty($name) || !is_string($name)) {

AND

Change line 117 in Zend_Feed_Writer_Entry to:

<pre class="highlight">
if (empty($name) || !is_string($name)) {

Comments

Posted by Frank Brückner (frosch) on 2012-10-24T17:14:33.000+0000

I think this issue is related to the PHP version, because in version 5.3.6 there are no errors:

<pre class="highlight">
$name = 'Joe';
var_dump($name['name']); // string (1) "J"

Posted by Frank Brückner (frosch) on 2012-10-24T17:16:43.000+0000

Add patches. (Unit tests already there.)

Posted by bullfrogblues (gerardroche) on 2012-10-25T13:14:39.000+0000

I'm using 5.4. But I think this code should never work. Maybe the new behaviour of 5.4 causes an exception rather than a hidden bug. http://php.net/manual/en/…

Posted by bullfrogblues (gerardroche) on 2012-10-25T13:15:44.000+0000

"As of PHP 5.4 string offsets have to either be integers or integer-like strings, otherwise a warning will be thrown. Previously an offset like "foo" was silently cast to 0." http://php.net/manual/en/…

Posted by Frank Brückner (frosch) on 2012-10-26T08:08:48.000+0000

Fix unit tests. (Replace "assertType")

Posted by Rob Allen (rob) on 2012-11-06T21:02:22.000+0000

Patch applied on trunk (25082) and release-1.12 (25083)

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts