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

sql_config_count() artificially limits number scope to 4byte-integer on PostgreSQL and Firebird

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.7-PL1
    • Fix Version/s: 3.0.8-RC1
    • Labels:
      None
    • Environment:
      PHP Environment: 5.3.2
      Database: PostgreSQL 8.2

      Description

      I get an error

      Value '6185080811' is out of range type integer.

      Problem is here in functions.php funktion set_config_count
      line 182.

      int4 for postgresql are only up to 2147483647. If the sum of the uploaded files(size) is over these limit, i get the described error.
      No problem if im under 2 GB as filesize in summary, but im already arround 6 GB

      I fixed it with changing int4 to int8

        Issue Links

          Activity

          Hide
          Oleg Oleg [X] (Inactive) added a comment -

          I will install "minimum versions" of postgres and firebird if you guys decide to proceed with the byte count. Post what you want tested.

          Show
          Oleg Oleg [X] (Inactive) added a comment - I will install "minimum versions" of postgres and firebird if you guys decide to proceed with the byte count. Post what you want tested.
          Hide
          Oleg Oleg [X] (Inactive) added a comment -

          >> (or 4GiB if we change it to unsigned)

          I think you should be very careful with that because php does not have unsigned integers.

          >>> PHP_INT_MAX+1
          2147483648

          >>> (int) (PHP_INT_MAX+1)
          -2147483648

          And for completeness:

          >>> (int) (PHP_INT_MAX+10000000000000000)
          -272564224

          Show
          Oleg Oleg [X] (Inactive) added a comment - >> (or 4GiB if we change it to unsigned) I think you should be very careful with that because php does not have unsigned integers. >>> PHP_INT_MAX+1 2147483648 >>> (int) (PHP_INT_MAX+1) -2147483648 And for completeness: >>> (int) (PHP_INT_MAX+10000000000000000) -272564224
          Hide
          Oleg Oleg [X] (Inactive) added a comment -

          Case in point:

          >>> system('ls -l /huge')
          rw-rr- 2 pie pie 2679696628 Apr 2 19:54 /huge
          >>> filesize('/huge')
          -1615270668

          Show
          Oleg Oleg [X] (Inactive) added a comment - Case in point: >>> system('ls -l /huge') rw-r r - 2 pie pie 2679696628 Apr 2 19:54 /huge >>> filesize('/huge') -1615270668
          Hide
          bantu Andreas Fischer added a comment - - edited

          It would work like this, but we cannot extend it beyond the 4GiB limit on 32-bit, because filesize() returns an integer.

          afischer@miraculix:~$ echo "<?php var_dump(PHP_INT_MAX);" | php
          int(2147483647)
          afischer@miraculix:~$ echo "<?php var_dump(filesize('LinuxMCE-8.10-beta2.iso'));" | php
          int(-400189440)
          afischer@miraculix:~$ echo "<?php var_dump((float) sprintf('%u', filesize('LinuxMCE-8.10-beta2.iso')));" | php
          float(3894777856)
          

          If there is an overflow somewhere, please create a new ticket. However, if there is one the issue is kind of slim because PHP also limits the actual upload size.

          Show
          bantu Andreas Fischer added a comment - - edited It would work like this, but we cannot extend it beyond the 4GiB limit on 32-bit, because filesize() returns an integer. afischer@miraculix:~$ echo "<?php var_dump(PHP_INT_MAX);" | php int(2147483647) afischer@miraculix:~$ echo "<?php var_dump(filesize('LinuxMCE-8.10-beta2.iso'));" | php int(-400189440) afischer@miraculix:~$ echo "<?php var_dump((float) sprintf('%u', filesize('LinuxMCE-8.10-beta2.iso')));" | php float(3894777856) If there is an overflow somewhere, please create a new ticket. However, if there is one the issue is kind of slim because PHP also limits the actual upload size.
          Hide
          bantu Andreas Fischer added a comment -

          All right. I pushed the change I intend to make.

          It would have to be tested on PostgreSQL 7.3 and Firebird 2.1. Those are the minimum requirements as per the INSTALL.html.

          Thanks for testing.

          Show
          bantu Andreas Fischer added a comment - All right. I pushed the change I intend to make. It would have to be tested on PostgreSQL 7.3 and Firebird 2.1. Those are the minimum requirements as per the INSTALL.html. Thanks for testing.

            People

            • Assignee:
              bantu Andreas Fischer
              Reporter:
              ithierack ithierack
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development