Architecture / Installation

Architecture / Installation

Segfault when posting Wiki content with {CODE(colors=>php)}

posts: 6 United States
Apache segfaults when I post an entry in the Wiki with {CODE()}
 If I use {CODE()}
 it posts fine. I tried doing a die($data) after the highlighting and that works fine, so it's not the highlighting itself. I also tried useing PEAR::Text_Highlighter and it made no difference.

posts: 2881 United Kingdom

There is a similar problem with Debain and Image Gallerys if you use SID.

That particular image gallery problem is a Debain one, not a Tiki one.

Maybe they are related?


posts: 6 United States
I'm using Gentoo and I don't think I have any special settings. Are you talking about trans_sid?

posts: 111 Taiwan

no it's not related to GD at all !
the CODE plugin uses highlight_string php command, get_html_translation_table, array_flip, maybe one of those functions don't work on your php ? what's its version ?


posts: 6 United States

I'm using PHP v4.3.6. I know that PHP highlighting works fine, it's just in this context where it fails. I tried using the PEAR Code highlighter instead of the built-in one, but that also segfauls. Seems to be only for large pieces of text, small 5-line entries work.

I also tried switching to PEAR's Text_Highlight package and it still crashes.

I tried commenting out the decodeHTML code and it doesn't crash. I tried using a foreach instead of a strtr and that doesn't do it, still segfaults. The funny thing is, it segfaults *after* this whole plugin returns.

Could someone else try putting a hige chunk of PHP in a code block and see if it works for them?

posts: 6 United States
Oh, also, using html_entity_decode still makes it crash. I'm stumped...I have no idea whyt his would be happening.

posts: 2

I am seeing this when there is a large amount of data in the CODE block

It seems to be specific to my installation as the same code works in other tikiwiki's. I generated some text using:

$ i=0 ; while [ $i != 107 ] ; do 
echo "$i -------------------------------------------------------------------------------" ; i=`expr $i + 1 ` ; 
done ; echo "107 abcdefghijklmnopqrstuvxyzabcdef"

and put it inside a CODE block. This displays ok. However if I add one more character, apache seg faults. It seems specific to the amount of data, not the number or length of lines.

posts: 2

From lib/wiki-plugins/wikiplugin_code.php

Neither of the two lines for $data on line s62 and 63 work, however removing the ~np~ and trim bits prevents the crash. (It doesn't display correctly though)