Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-9132

Oracle CLOB support is broken, preventing storage of long strings

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.0.7
    • Fix Version/s: 3.0.8-RC1
    • Component/s: Other
    • Labels:
      None
    • Environment:
      PHP Environment: 5.2.5
      Database: Oracle 10.2.0.4

      Description

      What version of phpBB are you using? phpBB 3.0.7
      What is your board's URL? No answer given
      Who do you host your board with? Company server
      How did you install your board? I used the download package from phpBB.com
      Is your board a fresh install or a conversion? Update from a previous version of phpBB3
      Do you have any MODs installed? Yes
      Is registration required to reproduce this issue? No
      What version of phpBB3 did you update from? phpBB 3.0.2
      What MODs do you have installed? Topic View Tracker
      What styles do you currently have installed? Prosilver
      What language(s) is your board currently using? EN
      Which database type/version are you using? Oracle
      What is your level of experience? New to PHP and phpBB
      When did your problem begin? After upgrading from 3.0.2 to 3.0.7.
      Please describe your problem. This is a test instance that's copied from our production board, separate database but identical setup. After upgrading to anything past 3.0.5 (ie 3.0.6 or 3.0.7), will get ORA-01756: quoted string not properly terminated [1756] error.

      I can bypass the error by editing phpBB3/styles/prosilver/template/overall_header.html, remove the space in front of " 'height=225,resi....." in the line that says window.open(url.replace(/&/g, '&'), '_phpbbprivmsg', 'height=225,resizable=yes,scrollbars=yes, width=400');.

      Then, the next error will occur whenever I try to post, w/ error ORA-01704: string literal too long [1704].

      This seems like a CLOB problem, anything larger than 4000 character isn't getting inserted on this particular page.

      Error detail see attached image.

      1. err.JPG
        293 kB
      2. err2.JPG
        188 kB

        Issue Links

          Activity

          Hide
          6502 6502 added a comment -

          Forget DBMS_LOB. Its much easier. OCI8 can do. I found the description how to handle CLOBs with PHP in the Oracle Technet:
          http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_lobs.html

          Regards
          6502

          P.S.: Urgently waiting for the Fix...

          Show
          6502 6502 added a comment - Forget DBMS_LOB. Its much easier. OCI8 can do. I found the description how to handle CLOBs with PHP in the Oracle Technet: http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_lobs.html Regards 6502 P.S.: Urgently waiting for the Fix...
          Hide
          A_Jelly_Doughnut A_Jelly_Doughnut added a comment -

          I just want to double-check: posts of arbitrary length worked in phpBB 3.0.6 and/or phpBB 3.0.5? There were some changes to the oracle long string support between .0.6 and .0.7.

          Show
          A_Jelly_Doughnut A_Jelly_Doughnut added a comment - I just want to double-check: posts of arbitrary length worked in phpBB 3.0.6 and/or phpBB 3.0.5? There were some changes to the oracle long string support between .0.6 and .0.7.
          Hide
          A_Jelly_Doughnut A_Jelly_Doughnut added a comment -

          Actually, looking again, it looks like the actual bug was introduced in 3.0.6. 3.0.5 should be unaffected, but 3.0.6 should be. You can verify by pulling the includes/db/oracle.php out of old phpBB packages, available via phpBB.com.

          Show
          A_Jelly_Doughnut A_Jelly_Doughnut added a comment - Actually, looking again, it looks like the actual bug was introduced in 3.0.6. 3.0.5 should be unaffected, but 3.0.6 should be. You can verify by pulling the includes/db/oracle.php out of old phpBB packages, available via phpBB.com.
          Hide
          6502 6502 added a comment -

          What's that "patience" people talk about?

          Thanx to A_Jelly_Doughnut for the release check. I had a closer look at 3.0.5 then. The datatype of the column already was CLOB, they didn't change it. But they added some code in the includes/db/oracle.php. I commented out the new part in the INSERT-branch of the oracle.php (release 3.0.7-PL1), tried a large post, and it worked. The lines commented out range from 266 to 312. Below the part of Code I commented out:

          if (sizeof($cols) !== sizeof($vals))
          {
          // Try to replace some common data we know is from our restore script or from other sources
          $regs[3] = str_replace("'||chr(47)||'", '/', $regs[3]);
          $_vals = explode(', ', $regs[3]);

          $vals = array();
          $is_in_val = false;
          $i = 0;
          $string = '';

          foreach ($_vals as $value)
          {
          if (strpos($value, "'") === false && !$is_in_val)

          { $vals[$i++] = $value; continue; }

          if (substr($value, -1) === "'")
          {
          $vals[$i] = $string . (($is_in_val) ? ', ' : '') . $value;
          $string = '';
          $is_in_val = false;

          if ($vals[$i][0] !== "'")

          { $vals[$i] = "''" . $vals[$i]; }

          $i++;
          continue;
          }
          else

          { $string .= (($is_in_val) ? ', ' : '') . $value; $is_in_val = true; }

          }

          if ($string)

          { // New value if cols != value $vals[(sizeof($cols) !== sizeof($vals)) ? $i : $i - 1] .= $string; }

          $vals = array(0 => $vals);
          }

          I have no time to analyze the code, because I have to learn PHP first
          I'm just an Oracle Freak, so I only can offer this as a temporary workaround for inserting new posts.

          Show
          6502 6502 added a comment - What's that "patience" people talk about? Thanx to A_Jelly_Doughnut for the release check. I had a closer look at 3.0.5 then. The datatype of the column already was CLOB, they didn't change it. But they added some code in the includes/db/oracle.php. I commented out the new part in the INSERT-branch of the oracle.php (release 3.0.7-PL1), tried a large post, and it worked. The lines commented out range from 266 to 312. Below the part of Code I commented out: if (sizeof($cols) !== sizeof($vals)) { // Try to replace some common data we know is from our restore script or from other sources $regs [3] = str_replace("'||chr(47)||'", '/', $regs [3] ); $_vals = explode(', ', $regs [3] ); $vals = array(); $is_in_val = false; $i = 0; $string = ''; foreach ($_vals as $value) { if (strpos($value, "'") === false && !$is_in_val) { $vals[$i++] = $value; continue; } if (substr($value, -1) === "'") { $vals [$i] = $string . (($is_in_val) ? ', ' : '') . $value; $string = ''; $is_in_val = false; if ($vals [$i] [0] !== "'") { $vals[$i] = "''" . $vals[$i]; } $i++; continue; } else { $string .= (($is_in_val) ? ', ' : '') . $value; $is_in_val = true; } } if ($string) { // New value if cols != value $vals[(sizeof($cols) !== sizeof($vals)) ? $i : $i - 1] .= $string; } $vals = array(0 => $vals); } I have no time to analyze the code, because I have to learn PHP first I'm just an Oracle Freak, so I only can offer this as a temporary workaround for inserting new posts.
          Hide
          A_Jelly_Doughnut A_Jelly_Doughnut added a comment -

          It appears the feature that was fixed by the Oracle code added by 3.0.6 was the database backup/restore in the ACP.

          Show
          A_Jelly_Doughnut A_Jelly_Doughnut added a comment - It appears the feature that was fixed by the Oracle code added by 3.0.6 was the database backup/restore in the ACP.

            People

            • Assignee:
              A_Jelly_Doughnut A_Jelly_Doughnut
              Reporter:
              dennishou dennishou
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development