Bug tracker

This ticket has been moved to our new tracker. Open Ticket PHPBB3-9020 now.

truncate_string not working correctly when replying (fix completed in vcs)

Data too long for column 'post_subject' at row 1 [1406]

Text length it tried to allow: 259:
Code: Select all
Re: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


Was using this:
Code: Select all
$subject = truncate_string($subject, 254);


EDIT: Seems to work properly on submitting a topic, but if you reply to a topic it seems not to work...

Comments / History

Edited ticket

Action performed by EXreaction (Former Team Member) on Jan 15th 2010, 03:33

Edited ticket

Action performed by EXreaction (Former Team Member) on Jan 15th 2010, 03:35

Posted by EXreaction (Former Team Member) on Jan 15th 2010, 03:40

And easy fix:

Open:
includes/functions_content.php

Find:
Code: Select all
   if ($allow_reply && strpos($string, 'Re: ') === 0)
   {
      $strip_reply = true;
      $string = substr($string, 4);
   }


In the if statement add:
Code: Select all
      $max_store_length -= 4;

Posted by A_Jelly_Doughnut (MOD Team Member) on Jan 15th 2010, 16:36

Related to: http://www.phpbb.com/bugs/phpbb3/33885

Also: http://www.phpbb.com/bugs/phpbb3/25235 (which was fixed with r8667)

Essentially, setting $max_store_length -= 4; is the same as removing the "allow reply" functionality altogether. I'm not sure I understand the reason behind having the $allow_reply parameter, tbh. I guess it was a holdover from before #25235 was fixed, when the DB field was 64 chars and the maximum length allowed was 60. Could we depricate this parameter?

Assigned ticket to user "A_Jelly_Doughnut"

Action performed by A_Jelly_Doughnut (MOD Team Member) on Jan 25th 2010, 17:52

Changed ticket status from "New" to "Fix in progress"

Action performed by A_Jelly_Doughnut (MOD Team Member) on Jan 25th 2010, 17:58

Linked ticket with changeset: r10442

Action performed by Anonymous (I am too lazy to register) on Jan 25th 2010, 18:02

Changed ticket status from "Fix in progress" to "Fix completed in SVN"

Action performed by A_Jelly_Doughnut (MOD Team Member) on Jan 25th 2010, 18:02

Ticket details

Related SVN changesets