Error in categorycontroller.php
Replies: 1   Views: 820  Subscribers: 2

Posted by wordifier · 01-03-2013 - 23:17

When clicking on a Category Title directly, we see an error as follows:

"Fatal error: Call to a member function getName() on a non-object in /.../vendor/codeconsortium/ccdn-forum-bundle/CCDNForum/ForumBundle/Controller/CategoryController.php on line 67"

This is caused by the "$category" var retrieving an array item with key, whereas the rest of the method expects the raw array item (no key).

I am not sure of the impact in other parts of the code, but my solution was to change:

"$category->getName()" to "$category­[0]­->getName()"
"'category' => $category," to "'category' => $category­[0]­,"

After that, the page displays fine.

There are other (maybe better) ways to code the fix, but this is without any doubt a problem.­

Posted by reece · 02-03-2013 - 20:29

Thanks, if you have a PR i am happy to merge, otherwise i will fix this asap.­