Wiki source for NonObjectMemberFunction


Show raw source

===== Fatal error: Call to a member function on a non-object =====

==Description of the problem==
Received this error today (march 25 2005)

~''Fatal error: Call to a member function on a non-object in /var/www/emp.empornium.us/wikka/formatters/wakka.php on line 186''

I had copied the FormattingRules page to my own wiki (you really should include it with your install). I disabled html embedding in wiki pages in the wikka.config.php with the line

~''"double_doublequote_html" => "disabled",''

i deleted a section at the end of FormattingRules wherei guess a cohort had included brief html embed instructions. When i clicked Store, the resulting page (which would have displayed the complete edit) gave the above error.

It's wierd because any attempt EXCEPT by /edit to parse that page at all results in that error. Even history.



----
~I discovered that the error occurs on use of double double quotes to escape from the wikitext renderer. We run with magic quotes off, but adding ''set_magic_quotes_runtime(1);'' to the top of formatters/wakka.php produced the same error
~Suggestions?
----
~Yes, that is what happened. Do you know of any way other than
%%(wiki)
"
%%
~to use quotes in wikka without them appearing as question marks? --Jmax1632


==Possible solution==

~& It might help to change the %%(php) $allowed_double_doublequote_html = $wakka->GetConfigValue("double_doublequote_html");%%to %%(php) $allowed_double_doublequote_html = $this->GetConfigValue("double_doublequote_html");%% or %%(php) $allowed_double_doublequote_html = $wakka->config["double_doublequote_html"];%% in formatters/wakka.php. This just a blind guess though. -- TimoK
~~& Ok, I just tried some things on my own wikka - the first change most propably doesn't change anything for you, since it produces the error you get when I make it. On further thinking (aka after some coffein) it was really stupid, since there is no $this at that place. Question: Does GeShi work for you? Or using % % without the space at all? (Please test on a simple page with no html or anything else, just one line of to-be-hilighted code) -- TimoK
~~~& It seems the %%(php) global $wakka;%% is ignored. I found a similar problem [[http://www.issociate.de/board/post/190321/class_and_global.html | here]] and it was beeing solved by globaling the object before its creation and not creating it by reference. Applied to wikka this means you need to go into your wikka.php and change the line %%(php)$wakka =& new Wakka($wakkaConfig); # create object by reference%% to %%(php)$wakka = new Wakka($wakkaConfig); # create object NOT by reference%% and add a %%(php) global $wakka;%% in front of it. (Sorry for needing three edits to come up with this, I just shouldn't try to solve problems I can't 'live-test' that early in the morning.) -- TimoK

----
====Solution====

When ''"double_doublequote_html" => "disabled"'' configuration is set, the current version of wikka then refers to the incorrect class when parsing ddq.

**FIND** in formatters/wakka.php
%%return $this->htmlspecialchars_ent($matches[1]);%%
**REPLACE WITH**
%%return $wakka->htmlspecialchars_ent($matches[1]);%%

This statement is never touched as long as ''"double_doublequote_html" =>'' is not set to ''"disabled"''

Thanks JavaWoman for your solution, thanks TimoK for trying.

~& Ah well, I should stick to those things I can test or where I know the code 100% :) --TimoK

----
CategorySupport
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki