?
avatar danyj
danyj
22 Jan 2016

Testing 3.5.0 beta,
in 3.4.8 we can get params via

public function onContentBeforeDisplay($context, $article, $params ){

    $show_vote = $params->get('show_vote');

    print_r($show_vote);

}

in 3.5.0 beta I get

Fatal error: Call to a member function get()....
avatar danyj danyj - open - 22 Jan 2016
avatar ggppdk
ggppdk - comment - 22 Jan 2016

This is not controlled by the CMS itself

  • but rather it is controlled by the component / extension, that is triggering the event.

Thus unless it is a CORE component that is passing empty params, this is not a CMS bug of J3.5.0 beta

  • many different extensions use it not just the CORE components
    • also some extensions may pass parameters that do not merge joomla global configuration at all, but i guess they should always pass non-empty params ?

For start more specific information is needed. You need to find the component or extension that is passing empty parameters and the exact place that this is happening. Edit your plugin method onContentBeforeDisplay, and add to it:

if ( empty($params) )
{
  echo "<pre>";
  debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  echo "</pre>";
  die('Found empty params at ...');
}
avatar danyj
danyj - comment - 22 Jan 2016

@ggppdk Thnx for the reply
it is core , and joomla article category or item view, any content plugin that is requesting params in

onContentBeforeDisplay

is failing ,

here is your print
screenshot_16

params are there ,
http://prntscr.com/9tkg41
the thing is that

$params->get

does not function on 3.5 as in prev version, looks like the params are empty before the plugin is requesting them.

I have 3 content plugins and they all have same issue.

avatar danyj
danyj - comment - 22 Jan 2016

I can "fix " my plugins by doing

if ( empty($params) ){
    return;
}

in my functions but thing is that this worked without any issues before.

avatar ggppdk
ggppdk - comment - 23 Jan 2016

In current staging the events are triggered twice:

  • once in JViewLegacy with ->core_params which does not exist, thus the effect that you see
  • and once in all views that extend JViewLegacy e.g. ContentViewCategory

https://github.com/joomla/joomla-cms/blob/staging/libraries/legacy/view/category.php#L161-L168

the empty parameters are coming from the 1st triggering, which should be easy to fix by replacing ->core_params with ->params

about double event triggering i don't know

See conversation here:
#8024
@wilsonge @mbabker

avatar brianteeman brianteeman - close - 23 Jan 2016
avatar danyj
danyj - comment - 23 Jan 2016

Thnx for the info , I will keep an eye on that thread.

avatar danyj danyj - change - 23 Jan 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-01-23 13:10:22
Closed_By danyj
avatar danyj danyj - close - 23 Jan 2016
avatar danyj danyj - close - 23 Jan 2016
avatar brianteeman brianteeman - change - 8 Mar 2016
Labels Added: ?

Add a Comment

Login with GitHub to post a comment