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

Missing / bad default values of CPFs result in SQL errors on registration of new users

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.6
    • Fix Version/s: 3.0.8-RC1
    • Labels:
      None
    • Environment:
      PHP Environment: PHP Version 5.2.6-1+lenny4
      Database: MySQL 5.0.51a-24

      Description

      I searched for this one before reporting but couldn't find it ... hope this not a double report again

      the error occurs on the registration page of new users - right after they "try" to submit there initial profile und usere-credentials!

      first the error from phpBB:
      Allgemeiner Fehler
      SQL ERROR [ mysql4 ]

      Incorrect integer value: '' for column 'pf_forumpoints' at row 1 [1366]

      SQL

      INSERT INTO cd_profile_fields_data (pf_selectionfield1, user_id, pf_string1, pf_selectionfield2, pf_string2, pf_interger1, pf_integer2) VALUES (5, 1252, '', '1', '', '', '0')

      BACKTRACE

      FILE: includes/db/mysql.php
      LINE: 174
      CALL: dbal->sql_error()

      FILE: includes/functions_user.php
      LINE: 266
      CALL: dbal_mysql->sql_query()

      FILE: includes/ucp/ucp_register.php
      LINE: 328
      CALL: user_add()

      I changed the names of the pf_* fields to reflect what they are.

      the only field that is schown on the registration page is the selectionfield1.

      the problem hereby lies however with the integer1 field .. but as far as I can tell on a totally different place:
      It was created over the acp (as it should be) as an integer field .. but the default value was either left blank or set to 0 (zero) an edited afterwards (read below)!
      on registration the custom_prfile_field class then tries "correctly" to insert "nothing" '' into the database which of course results in a mysql-error beacause the type of the column is int_something (actually BIGINT)

      normally I would say: too bad - get yourself a new admin if he can't fill out the proper fields ... but the problem occurred later!
      I changed the language description after creating that field and than the DEFAULT_VALUE of that field is left blank in the ACP and of course goes that way back in the DB!

      so I would say the "bug" lies within the acp_profile.

      But looking at the table phpBB_profile_fields_data I noticed something very odd after the creation of a new field:
      I created an integer-field with a default-value of 0 (zero) and in the DB that column was created with a default value of NULL (DB-Null) and of course set to NULL for alle rows already existing within the table.
      there comes this question up: why setting a default-value anyway, if it is ignored on creation? and why is within the DB in the table-specs the default-value not used? (I guess the last one is an issue with some DB-systems?)

      I hope it helps (and my english was understandable )

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: