Truncated entries !

Found a bug? Tell us!!
Post Reply
marcolino
Regular
Posts: 10
Joined: Tue Mar 14, 2006 6:02 pm

Truncated entries !

Post by marcolino »

Hi, all
I don't know if it's an error (mine ? webserver's ? s9y's ?), but I don't find any documentation about this behaviour: when posting long entries (say 65k or more), I find them truncated (to a variable size, near 60KB, however), in the mysql 'serendipity_entries.extended' text field (and hence in the blog ...). It both happens using the standard html editor or fckeditor. My websevers's PHP 'post_max_size' is set to 8M, 'upload_max_size' to 50M.
Any clue ? Is it by design or a bug ?
Thanks in advance.

Marcolino
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Truncated entries !

Post by garvinhicking »

Hi!

HTTP POST requests are limited to 65kb in the textarea, this is sadly a browser limitation. So you cannot post data larger than 65kb. You can split it up into 2x 65kb by using the Extended Entry field as well...

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
marcolino
Regular
Posts: 10
Joined: Tue Mar 14, 2006 6:02 pm

Re: Truncated entries !

Post by marcolino »

garvinhicking wrote:
...
HTTP POST requests are limited to 65kb in the textarea, this is sadly a browser limitation.
...
Hmmm ... You are right, Garvin, as ever ;-) ...
Actually I have tested it with FF 1.5 and IE 6 on a win32 platfom, and both have that limit. Googling a bit, I found there is no such limit in HTTP nor HTML specifications, it's only a browser implementation choice ... not much to do, I see ... Should it at least be possible - for s9y - to check for the data size before and after the post, and, if they do not match, issue an alert/warning/error message ?
Thanks again !

Marcolino
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Truncated entries !

Post by garvinhicking »

Hi!

Sadly getting the length would depend on javascript and would be different for each used WYSIWYG editor, so implementing this would get a bit tricky :-/

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
marcolino
Regular
Posts: 10
Joined: Tue Mar 14, 2006 6:02 pm

Re: Truncated entries !

Post by marcolino »

I see ... :-(
What do You suggest, then: might I put a big red note on my serendipity front page (which I would like to use as a professional community documents exchange site): "Please avoid posts bigger than 12 pages, they will be truncated !" ???

I would like to ask many more things, but I'm afraid I'm going to hit he 65k limit ... ;-)

My best regards

Marcolino
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Truncated entries !

Post by garvinhicking »

Hi!

Yes, I would put such a note online on the backend. You could use an easy plugin like this to display a note on the edit entry section:

Code: Select all

<?php
class serendipity_event_sizewarning extends serendipity_event {
    function introspect(&$propbag) {
        global $serendipity;

        $propbag->add('name',          'Sizewarnin');
        $propbag->add('description',   '');
        $propbag->add('stackable',     false);
        $propbag->add('author',        'Garvin Hicking');
        $propbag->add('requirements',  array(
            'serendipity' => '0.8',
            'smarty'      => '2.6.7',
            'php'         => '4.1.0'
        ));
        $propbag->add('version',       '1.0');
        $propbag->add('event_hooks',    array('backend_entry_toolbar_body' => true));
        $propbag->add('groups', array('BACKEND_EDITOR'));
    }

    function event_hook($event, &$bag, &$eventData) {
        global $serendipity;

        $hooks = &$bag->get('event_hooks');
        if (isset($hooks[$event])) {
            switch($event) {
                case 'backend_entry_toolbar_body':
                    echo '<h1>WARNING: NO TEXTS LONGER THAN 65kb!</h1>';

                    return true;
                    break;

                default:
                    return false;
                    break;
            }
        } else {
            return false;
        }
    }
}
?>
Save that as plugins/serendipitY_event_sizewarning/serendipitY_event_sizewarning.php and install it. You can modify the outputted HTML code of course.

Regards,Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply