? Success

User tests: Successful: Unsuccessful:

avatar demis-palma
demis-palma
27 Aug 2015

How to reproduce

On the plugin manager, disable the user's default editor plugin and the system's default editor plugin. If unsure, feel free to disable all the editor plugins.
Open Article Manager to edit an article. This involves the editor and raises the warnings.

Symptoms

Trying to instantiate an editor that is not available, a PHP notice and a PHP warning are generated in the error output:

PHP Notice: Trying to get property of non-object in [...]/libraries/cms/editor/editor.php on line 508
PHP Warning: Attempt to assign property of non-object in [...]/libraries/cms/editor/editor.php on line 510

Cause

This happens because JEditor::_loadEditor() function calls JPluginHelper::getPlugin() without considering its return type.
JPluginHelper::getPlugin() can return either an object or an array (WTF?), while JEditor::_loadEditor() always suppose (ingenuously) to deal with an object.

When no matching plugin is found, an empty array is returned to $plugin;
$plugin = JPluginHelper::getPlugin('editors', $this->_name);

this subsequent code raises the PHP Notice
$params->loadString($plugin->params);

this subsequent code raises the PHP Warning
$plugin->params = $params;

Fix

As the subsequent code needs to deal with a valid object, simply ensure to provide a valid object rather than overcomplicate the code adding further if / else / return statements.

avatar demis-palma demis-palma - open - 27 Aug 2015
avatar demis-palma demis-palma - change - 27 Aug 2015
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 27 Aug 2015
Labels Added: ?
avatar demis-palma demis-palma - change - 27 Aug 2015
The description was changed
avatar AlexRed
AlexRed - comment - 27 Aug 2015

@test Working good to me. Successful test.

avatar zero-24 zero-24 - change - 27 Aug 2015
Category Libraries
avatar laoneo laoneo - test_item - 27 Aug 2015 - Tested successfully
avatar laoneo
laoneo - comment - 27 Aug 2015

@test Success for me too.


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

avatar zero-24 zero-24 - alter_testresult - 27 Aug 2015 - AlexRed: Tested successfully
avatar zero-24 zero-24 - change - 27 Aug 2015
Status Pending Ready to Commit
avatar zero-24
zero-24 - comment - 27 Aug 2015

RTC based on testing. Thanks!


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

avatar joomla-cms-bot joomla-cms-bot - change - 27 Aug 2015
Labels Added: ?
avatar wilsonge wilsonge - change - 1 Sep 2015
Milestone Added:
avatar Kubik-Rubik Kubik-Rubik - change - 3 Sep 2015
Milestone Added:
avatar Kubik-Rubik Kubik-Rubik - change - 3 Sep 2015
Milestone Removed:
avatar kathastaden kathastaden - test_item - 10 Sep 2015 - Tested successfully
avatar Flow87 Flow87 - test_item - 18 Sep 2015 - Tested successfully
avatar rdeutz
rdeutz - comment - 5 Oct 2015

I don't like how this is done. It only works because you can't uninstall the "none"-Editor and you are using the "none"-Editor plugin, if it is published or not. It would be cleaner to inform the user and not initialize an editor. That would mean in a situation you can't edit an article or such things, not great but this might be something you like to achieve for a period of time.

avatar rdeutz rdeutz - change - 5 Oct 2015
Status Ready to Commit Needs Review
avatar zero-24 zero-24 - change - 5 Oct 2015
Labels Removed: ?
avatar zero-24 zero-24 - change - 5 Oct 2015
Milestone Removed:
avatar zero-24
zero-24 - comment - 6 Oct 2015

Closing as we have a more cleaner and better fix by @rdeutz here: #8017 Thanks.

avatar zero-24 zero-24 - change - 6 Oct 2015
Status Needs Review Closed
Closed_Date 0000-00-00 00:00:00 2015-10-06 08:14:55
Closed_By zero-24
avatar zero-24 zero-24 - close - 6 Oct 2015
avatar zero-24 zero-24 - close - 6 Oct 2015
avatar demis-palma demis-palma - head_ref_deleted - 28 Feb 2016

Add a Comment

Login with GitHub to post a comment