User tests: Successful: Unsuccessful:
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.
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
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;
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.
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Category | ⇒ | Libraries |
@test Success for me too.
Status | Pending | ⇒ | Ready to Commit |
RTC based on testing. Thanks!
Labels |
Added:
?
|
Milestone |
Added: |
Milestone |
Added: |
Milestone |
Removed: |
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.
Status | Ready to Commit | ⇒ | Needs Review |
Labels |
Removed:
?
|
Milestone |
Removed: |
Status | Needs Review | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-10-06 08:14:55 |
Closed_By | ⇒ | zero-24 |
@test Working good to me. Successful test.