Project

General

Profile

Bug(バグ) #4162

Updated by Shinichi Urabe over 2 years ago

h3. Overview (概要)

MySQL 5.7 の Strict Mode が有効な状態での動作確認 (#4033) を行った際に発生した。

fixture の読み込みを必要とするテストコードを実行すると下記のエラーが発生する:

<pre>
$ php plugins/opMessagePlugin/test/unit/model/SendMessageDataTest.php
PHP Fatal error: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[HY000]: General error: 1364 Field 'message_id' doesn't have a default value' in /vagrant/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php:1082
Stack trace:
#0 /vagrant/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/Statement.php(269): Doctrine_Connection->rethrowException(Object(PDOException), Object(Doctrine_Connection_Statement))
#1 /vagrant/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php(1042): Doctrine_Connection_Statement->execute(Array)
#2 /vagrant/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php(687): Doctrine_Connection->exec('INSERT INTO del...', Array)
#3 /vagrant/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/UnitOfWork.php(647): Doctrine_Connection->insert(Object(DeletedMessageTable), Array)
#4 /vagrant/lib/ven in /vagrant/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1082
</pre>

h3. Causes (原因)

source:test/fixtures/010_message.yml@6eef6b49#L106:
<pre><code class="yaml">
DeletedMessage:
dust_delete_mesage:
id: 1
Member: first_member
message_send_list_id: 3
is_deleted: 0
</code></pre>

上記の fixture で、NOT NULL 制約のある deleted_message. message_id deleted_message.member_id に値がセットされていないことが原因。

Back