JEditor Fatal error

This forum is for general questions about extensions for Joomla! version 1.5.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
Entea
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Mon Jun 08, 2009 8:17 am

JEditor Fatal error

Post by Entea » Mon Jun 08, 2009 8:56 am

Hi all, I got a problem with JEditor.

I am using Joomla 1.5.11 .

Here is the code:

Code: Select all

$editor->display("text",  stripslashes($html), $width, $height, '60', '20', true) ;
And here is what I got:

Code: Select all

Fatal error: Call to a member function on a non-object in D:\www\j\plugins\editors\tinymce.php on line 433
This error happens with all the editors (only the error line, and the file name differs)
I have digged into the code, and found out that the error occurs in

Code: Select all

function _displayButtons($name, $buttons)
This code used to work well in previous versions of Joomla.
Any ideas? )

 
Entea
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Mon Jun 08, 2009 8:17 am

Re: JEditor Fatal error

Post by Entea » Mon Jun 08, 2009 9:36 am

Well, I made a research, and found out the following:

The plugin plgButtonImage in editor-xtd group is returning NULL on it's onDisplay event in some conditions, and it results in fatal error in editor plugins (tinyMCE, None, whatever) in this loop (code for tinymce.php)

Code: Select all

function _displayButtons($name, $buttons)
	{
		// Load modal popup behavior
		JHTML::_('behavior.modal', 'a.modal-button');

		$args['name'] = $name;
		$args['event'] = 'onGetInsertMethod';

		$return = '';
		$results[] = $this->update($args);
		foreach ($results as $result) {
			if (is_string($result) && trim($result)) {
				$return .= $result;
			}
		}

		if(!empty($buttons))
		{
                //////// ---- THIS LINE HAS AN ERROR -------------  \\\\\\\\\\\\\\\\\\
			$results = $this->_subject->getButtons($name, $buttons);[/b]
	
			/*
			 * This will allow plugins to attach buttons or change the behavior on the fly using AJAX
			 */
			$return .= "\n<div id=\"editor-xtd-buttons\">\n";
			foreach ($results as $button)
			{
				/*
				 * Results should be an object
				 */
                        //////// ---- THIS LINE HAS AN ERROR -------------  \\\\\\\\\\\\\\\\\\
				if ( $button->get('name') )
				{
					$modal		= ($button->get('modal')) ? 'class="modal-button"' : null;
					$href		= ($button->get('link')) ? 'href="'.JURI::base().$button->get('link').'"' : null;
					$onclick	= ($button->get('onclick')) ? 'onclick="'.$button->get('onclick').'"' : null;
					$return .= "<div class=\"button2-left\"><div class=\"".$button->get('name')."\"><a ".$modal." title=\"".$button->get('text')."\" ".$href." ".$onclick." rel=\"".$button->get('options')."\">".$button->get('text')."</a></div></div>\n";
				}
			}
			$return .= "</div>\n";
		}

		return $return;
	}
$results = $this->_subject->getButtons($name, $buttons); - Here, the editor-xtd plugins get called, and one of the array items is null
and the call to $button->get('name') results in Fatal error, because it's NULL, not JObject, as it pretends to be in the code.


So, here is the solution:
in file: plugins/editors-xtd/image.php:

change the line #61

Code: Select all

return;
to

Code: Select all

return new JObject();
:)

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19014
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: JEditor Fatal error

Post by infograf768 » Tue Jun 09, 2009 4:04 pm

Please verify if this is corrected in this artefact.
http://joomlacode.org/gf/project/joomla ... m_id=16597
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

Entea
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Mon Jun 08, 2009 8:17 am

Re: JEditor Fatal error

Post by Entea » Wed Jun 10, 2009 4:30 am

infograf768 wrote:Please verify if this is corrected in this artefact.
http://joomlacode.org/gf/project/joomla ... m_id=16597
Yes it is :)

MAD King
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 154
Joined: Thu Aug 09, 2007 2:08 pm

Re: JEditor Fatal error

Post by MAD King » Fri Jun 26, 2009 2:43 pm

Thank you. Had the same bug.

marcotti
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Tue Oct 17, 2006 9:58 am

Re: JEditor Fatal error

Post by marcotti » Tue Jun 30, 2009 3:51 pm

Hi all,
I had a similar issue: I tried to change the fields in the list of the CB List manager and the buttons didn't work.
Reading the post I tried to assign NO EDITOR to admin and it worked!
But I have no clue why.

Joomla 1.5.7
CB 1.2.1

Cheers
marcotti

cols2910
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Fri Sep 25, 2009 10:00 am

Re: JEditor Fatal error

Post by cols2910 » Wed Mar 24, 2010 10:03 pm

Hello Everyone

I'm using Joomla 1.5.14 and just began seeing this error when attempting to edit a post at the front end.

I checked the image.php file as suggested but the code is now different and I see

return $button; at line 95.

So, I guess I;m unable to apply the fix suggested. Does anyone have any ideas as to what may be happening now?

For the record this is what I see with the various editors

JCE Editor
======

Fatal error: Call to a member function get() on a non-object in /home2/pmocafec/public_html/plugins/editors/jce.php on line 380

TinyMCE
=====

Fatal error: Call to a member function get() on a non-object in /home2/pmocafec/public_html/plugins/editors/tinymce.php on line 630

No Editor
=====

Fatal error: Call to a member function get() on a non-object in /home2/pmocafec/public_html/plugins/editors/none.php on line 170

I was hoping to launch soon so this is a real setback. Any help greatly appreciated.

Kind regards,
Cols

 

Locked

Return to “Extensions for Joomla! 1.5”