? Success

User tests: Successful: Unsuccessful:

avatar asika32764
asika32764
26 Jun 2015

Currently our router rules should return array, otherwise will return this error

Fatal error: Unsupported operand types in /path/to/joomla/libraries/cms/router/router.php on line 593

There are two choice:

  • Throw Exception to notice developer that they return wrong type.
  • Just force all value to array to ignore error.

I try to force return value to array that will prevent fatal error.

How to Test

Add a custom plugin or in any plugin onAfterInitialise event, add this code:

$closure = function(\JRouterSite $router, \JUri $uri)
{
    return;
};

$app = JFactory::getApplication();
$router = $app::getRouter();

$router->attachParseRule($closure, $router::PROCESS_BEFORE);

Then it will raise fatal error in frontend.

avatar asika32764 asika32764 - open - 26 Jun 2015
avatar asika32764 asika32764 - change - 26 Jun 2015
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 26 Jun 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 26 Jun 2015
Category Router / SEF
avatar zero-24 zero-24 - change - 26 Jun 2015
Easy No Yes
avatar asika32764 asika32764 - change - 26 Jun 2015
Title
Add (array) to rule return value
Add (array) to JRouter::_rules return value
avatar RickR2H
RickR2H - comment - 11 Jul 2015

@asika32764: Got some trouble getting the code right to produce the error, but the fix worked! :)


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7268.

avatar RickR2H RickR2H - test_item - 11 Jul 2015 - Tested successfully
avatar larapetersen
larapetersen - comment - 11 Jul 2015

Fix worked, error gone after applying the patch.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7268.

avatar larapetersen larapetersen - test_item - 11 Jul 2015 - Tested successfully
avatar roland-d roland-d - change - 11 Jul 2015
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2015-07-11 15:14:55
Closed_By roland-d
avatar roland-d roland-d - close - 11 Jul 2015
avatar roland-d roland-d - reference | 853804f - 11 Jul 15
avatar roland-d roland-d - merge - 11 Jul 2015
avatar roland-d roland-d - close - 11 Jul 2015
avatar zero-24 zero-24 - change - 11 Jul 2015
Milestone Added:

Add a Comment

Login with GitHub to post a comment