Bug #16809
closedFIX FOR Typo3 basic tables definition not compliant with MySQL 5.0 strict mode enabled by default
0%
Description
This relates to issues 0004691, 0002634 and 0002059
Issue occurs with MySQL 5.0 databases.
The reason for this issue occurring is :
Some fields in the table definitions are marked as NOT NULL while not providing any default values. When a Typo3 MySQL query does not specify a value for one of those fields, the query fails.
Also since MySQL 5.0, BLOB and TEXT columns cannot be assigned a default value ( but are set as NOT NULL in Typo3 basic table definition).
I have edited the tables.sql file used by typo3 to create a basic database during a fresh install and fixed these issues. It resolves issues 0004691, 0002634 and 0002059.
THIS FIX SHOULD BE APPLIED TO TYPO3 4.0/4.1 MAIN DEVELOPMENT TRUNK QUICKLY since more and more users are using MySQL 5.0 and they should be facing this problem.
Overwrite t3lib/stddb/tables.sql with the tables.sql file supplied in this issue report.
This update has been tested and can not break Typo3 since all it does is remove a few NOT NULL statements in fields definitions where they do not comply with MySQL Strict mode.
An alternate fix to these issues is to edit the MySQL configuration file (my.ini on windows, my.cnf on linux) and change the line :
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
to :
sql-mode="MYSQL40"
Then restart MySQL.
But since the bad SQL mode for Typo3 is specified by default into MySQL 5.0, Typo3 should adapt in order to comply and avoid having all newbies blocked in the install tool while facing this bug. Thus this patch has to be included into the main development trunk.
(issue imported from #M4693)
Files
Updated by Alban Cousinie almost 18 years ago
Note : this FIX has been edited based on original file tables.sql from typo3 4.0.4 distribution.
Updated by Alban Cousinie almost 18 years ago
Obviously it didn't fix every error : when I create my first page into my new typo3 installation, I get an error 'field url from table pages has no default value'.
This field url is not present into definition of table pages in the basic tables.sql file and thus it must be added at some point later from another file. Of course field 'url' is a field of type 'text' which can't be assigned a default value.
Thus the file I have provided is not the THE fix, but a part of the fix. If anyone know from where these additional fields to table pages are being added please post it below, and I'll attempt to fix it.
My fear is the problem can occur with many extensions creating their own tables not compliant with strict mode as well, so a more secure and permanent solution remains the MySQL configuration file sql-mode parameter tweaking.
Updated by Edgar Geisler almost 18 years ago
I'm a newbee using Typo3 4.04 with MySQL 5.0.27, Apache 2.2.3, PHP/5.2.0, Typo3 4.04 on a Windows XP machine.
Since there are a lot of open 'Backend Login Problems' reported over the web and this issue (04693) resolves ONLY a problem corresponding to data retrieval of a be_user in MySQL 5.x, I want to add, that Typo3 still remains BLOCKING newbee's (coming from the MS Windows corner) during login (more escpecially me).
Until today (wow, what a wounderful new year's start)!.
Digging into the problem I stumbled over a german Typo3 forum's contribution. It suggested to check the 'session'-parameters of the installation (sorry - source lost). For me, it was the substantial clue beside your patch and leads into the Typo3 backend.
In a lot of forum's contributions it was reported, that using LAMP won't create login problems to the backend. So - I haven't used LAMP so far (at this moment, while I'm writing this, I don't know, if LAMP is generally available for MS Windows ?).
I've installed the packages mentioned above from the root sites making escpecially some changes regarding Apache's VirtualHost and doc_root options.
Then, after unzipping the Typo3 CMS, the dummy package, the merging of tem, the execution of the installation script and the application of the patch, I ran into the mentioned backend login problem.
Well - I've fixed this by adding a
"session.auto_start = 1"
in the 'Session' section of the 'php.ini' file.
Updated by Steffen Müller almost 18 years ago
Keep in mind that this strict-mode incompatibilitiy also affects the following sysexts:
dbal, cms, impexp, indexedsearch, rtehtmlarea, sys_action, sys_note, tsconfig_help
I am sorry that I do not have the time to provide patches for all these extensions.
Updated by Steffen Müller almost 18 years ago
The Extension Kickstarter also produces text columns with NOT NULL attribute.
Beside that, maybe it's a good idea to mention proper CREATE TABLE statements in the coding guideline documentation, too.
Updated by Arnold Gordijn about 17 years ago
Hi,
I'm using WIN2003 PHP5 and MYSQL5 and TYPO3 Ver. 4.1.3
I tryed the new tables.sql
and yes than I could create a admin user
So could login but other things like improt from .t3d still fail due to NOT NULL and no default set.
I I would surgest the workaround sql-mode="MYSQL40"
Updated by Steffen Heinrich almost 17 years ago
You are sure giving a hard time to any newbie ;-)
I've had Apache 1.3, PHP5.2.3 and MySQL5.0.27 properly installed and running on Windows XP, then I decided to get TYPO3 4.1.5.
To make things short, there is at least one other issue with the installer having the same cause.
All imports into table static_tsconfig_help fail despite the installer's insistence that 117 rows were inserted.
CREATE TABLE static_tsconfig_help (
uid int(11) NOT NULL auto_increment,
guide int(11) DEFAULT '0' NOT NULL,
...
INSERT INTO static_tsconfig_help VALUES ('1', '', ...
Inserting an empty string into an int type field is definitely not the correct thing to do and that it is working with mysql 4 must be considered a severe bug in that version.
Only the subsequent error with creating the admin user had lead me on the right track.
sql-mode="MYSQL40" works but is a clutch. How can this problem be known for so long without a thorough fix?
Do the developers all work with old mysql?
For them there is no way but migrating to mysql 5 to get a hint where to start cleaning up that messy sql. Else trouble will keep haunting you.
just my 2p
(To save other user's from sharing the frustration, how bout at least adding a big red note of warning to the download page?)
Updated by Michael Stucki almost 17 years ago
Dmitry, will you have a look at this?
Updated by Dmitry Dulepov over 16 years ago
Attached patch fixes NOT NULL issue for core.