Mantis Bugtracker          
testlink.org

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007668TestLinkRequirement Managementpublic2016-09-13 10:062017-03-21 12:08
Reporterdaronz 
Assigned To 
PriorityurgentSeveritycrashReproducibilityalways
StatusnewResolutionopen 
PlatformWindowsOSWindows ServerOS Version2012 R2
Product Version1.9.15 (2015 Q4) 
Fixed in Version 
Summary0007668: DB Access Error when saving Requirements
DescriptionCannot save the log when I am editing Requirements
Steps To Reproduce1) Go to Requirement Spec.
2) Select a Requirement
3) Do any action that could be triggered to add a log
4) Click OK
Additional Information ==============================================================================
 DB Access Error - debug_print_backtrace() OUTPUT START
 ATTENTION: Enabling more debug info will produce path disclosure weakness (CWE-200)
            Having this additional Information could be useful for reporting
            issue to development TEAM.
 ==============================================================================
#0 database->exec_query( /* Class:requirement_mgr - Method: create_new_revision */ UPDATE req_versions SET revision = 2, log_message=' ', creation_ts = '2016-09-13 17:48:13' ,author_id = 32, modifier_id = NULL, modification_ts = NULL WHERE id = 107603 ) called at [D:\WebService\testlink\lib\functions\requirement_mgr.class.php:2947]
#1 requirement_mgr->create_new_revision(107603, 32, 1, Array ([id] => 107602,[srs_id] => 107600,[req_doc_id] => 001.1,[scope] =>

    Test

,[status] => D,[type] => 3,[active] => 1,[is_open] => 1,[author_id] => 32,[version] => 1,[version_id] => 107603,[expected_coverage] => 1,[creation_ts] => 2016-09-13 17:45:23,[modifier_id] => ,[modification_ts] => 2016-09-13 17:45:23,[revision] => 1,[revision_id] => -1,[title] => Test,[testproject_id] => 1,[req_spec_title] => Test,[req_spec_doc_id] => 001,[node_order] => 1,[author] => zhudl,[modifier] => ), ) called at [D:\WebService\testlink\lib\requirements\reqCommands.class.php:735]
0000002 reqCommands->doCreateRevision(, Array ([CSRFName] => CSRFGuard_1947398264,[CSRFToken] => f15317fe1130ba3fece5f4a750146c83453075f133c6a0f8c2d490800926b2f8ced6fd2187fd8e2e08b01085d005b8fc8ed98afbde8bda6f82d95f94fede53cb,[requirement_id] => 107602,[req_version_id] => 107603,[doAction] => doCreateRevision,[log_message] => )) called at [D:\WebService\testlink\lib\requirements\reqEdit.php:41]
TagsNo tags attached.
Database (MySQL,Postgres,etc)MySQL
BrowserChrome
PHP Version7.0.9
TestCaseID
QA Team - Task Workflow Status
Attached Fileszip file icon screenshot.zip [^] (217,718 bytes) 2016-09-13 10:06
zip file icon bug_on_testlink_lib_requirements_reqEdit.php.html.zip [^] (2,192 bytes) 2017-03-21 09:58

- Relationships

-  Notes
(0025401)
mbar (reporter)
2016-09-13 10:24

I confirm the problem:

 ==============================================================================
 DB Access Error - debug_print_backtrace() OUTPUT START
 ATTENTION: Enabling more debug info will produce path disclosure weakness (CWE-200)
            Having this additional Information could be useful for reporting
            issue to development TEAM.
 ==============================================================================
#0 database->exec_query(/* $debugMsg */ INSERT INTO req_revisions (parent_id,id,revision,scope,status,type,active,is_open, expected_coverage,author_id,creation_ts,modifier_id,modification_ts,log_message) SELECT REQV.id, 200274, 1, REQV.scope,REQV.status,REQV.type,REQV.active,REQV.is_open, REQV.expected_coverage,REQV.author_id,REQV.creation_ts,REQV.modifier_id, REQV.modification_ts,REQV.log_message FROM req_versions REQV WHERE REQV.id = 118648 ) called at [/var/www/html/testlink/lib/functions/requirement_mgr.class.php:2969]
#1 requirement_mgr->copy_version_as_revision(118648, 200274, 1, 2, 118372) called at [/var/www/html/testlink/lib/functions/requirement_mgr.class.php:2928]
0000002 requirement_mgr->create_new_revision(118648, 2, 118372, Array ([id] => 118647,[srs_id] => 118643,[req_doc_id] => test,[scope] =>

    test

,[status] => D,[type] => 5,[active] => 1,[is_open] => 1,[author_id] => 2,[version] => 1,[version_id] => 118648,[expected_coverage] => 1,[creation_ts] => 2014-07-14 12:52:02,[modifier_id] => ,[modification_ts] => 0000-00-00 00:00:00,[revision] => 1,[revision_id] => -1,[title] => ,[testproject_id] => 118372,[req_spec_title] => ,[req_spec_doc_id] => SWD21,[node_order] => 2,[author] => ,[modifier] => ), ) called at [/var/www/html/testlink/lib/functions/requirement_mgr.class.php:518]
0000003 requirement_mgr->update(118647, 118648, test,


, 2, D, 5, 1, , , 0, 1, ) called at [/var/www/html/testlink/lib/requirements/reqCommands.class.php:302]
0000004 reqCommands->doUpdate(stdClass Object ([requirement_id] => 118647,[req_version_id] => 118648,[req_spec_id] => 0,[req_title] => test,[req_id_cbox] => ,[reqDocId] => test,[reqStatus] => D,[reqType] => 5,[containerID] => ,[scope] =>
test

,[countReq] => ,[expected_coverage] => 1,[doAction] => doUpdate,[itemSet] => ,[testcase_count] => ,[copy_testcase_assignment] => ,[relation_id] => ,[relation_source_req_id] => ,[relation_type] => ,[relation_destination_req_doc_id] => ,[relation_destination_testproject_id] => ,[save_rev] => 1,[do_save] => 1,[log_message] => ,[tcaseIdentity] => ,[file_id] => ,[fileTitle] => ,[req_id] => 118647,[title] => ,[arrReqIds] => ,[basehref] => https://testlink./,[tproject_id] [^] => 118372,[tproject_name] => ,[tcasePrefix] => swd,[user_id] => 2,[refreshTree] => 1,[stay_here] => 0), Array ([CSRFName] => CSRFGuard_1635534596,[CSRFToken] => ,[req_spec_id] => 0,[requirement_id] => 118647,[req_version_id] => 118648,[last_doc_id] => NFPW.8,[save_rev] => 1,[log_message] => ,[goaway] => 1,[prompt4log] => 0,[do_save] => 1,[prompt4revision] => 1,[reqDocId] => PR.ODO.2.4,[req_title] => ,[scope] =>
test


,[reqStatus] => D,[reqType] => 5,[expected_coverage] => 1,[doAction] => doUpdate)) called at [/var/www/html/testlink/lib/requirements/reqEdit.php:41]
(0025402)
mbar (reporter)
2016-09-13 11:45

Additional info:

ERROR ON exec_query() - database.class.php
1292 - Incorrect datetime value: '0000-00-00 00:00:00' for column 'modification_ts' at row 1 - /* $debugMsg */ INSERT INTO req_revisions (parent_id,id,revision,scope,status,type,active,is_open, expected_coverage,author_id,creation_ts,modifier_id,modification_ts,log_message) SELECT REQV.id, 200274, 1, REQV.scope,REQV.status,REQV.type,REQV.active,REQV.is_open, REQV.expected_coverage,REQV.author_id,REQV.creation_ts,REQV.modifier_id, REQV.modification_ts,REQV.log_message FROM req_versions REQV WHERE REQV.id = 118648
THE MESSAGE : /* $debugMsg */ INSERT INTO req_revisions (parent_id,id,revision,scope,status,type,active,is_open, expected_coverage,author_id,creation_ts,modifier_id,modification_ts,log_message) SELECT REQV.id, 200274, 1, REQV.scope,REQV.status,REQV.type,REQV.active,REQV.is_open, REQV.expected_coverage,REQV.author_id,REQV.creation_ts,REQV.modifier_id, REQV.modification_ts,REQV.log_message FROM req_versions REQV WHERE REQV.id = 118648 Query failed: errorcode[1292] errormsg:Incorrect datetime value: '0000-00-00 00:00:00' for column 'modification_ts' at row 1
(0025403)
mbar (reporter)
2016-09-13 12:16

https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_zero_date [^]
(0025404)
mbar (reporter)
2016-09-13 12:19

And this seems to cause the problem (I have MySQL 5.7.15 installed):

mysql> SHOW VARIABLES LIKE 'sql_mode';
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| Variable_name | Value |
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| sql_mode | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------+
(0025405)
mbar (reporter)
2016-09-13 12:27

I reinitialized all 'modification_ts' values to current date (temporarily disabled strict_trans_tables, then enabled again), but it still fails.

Now the error is:

ERROR ON exec_query() - database.class.php
1048 - Column 'modification_ts' cannot be null - /* Class:requirement_mgr - Method: create_new_revision */ UPDATE req_versions SET revision = 2, log_message=' ', creation_ts = '2016-09-13 14:25:09' ,author_id = 2, modifier_id = NULL, modification_ts = NULL WHERE id = 118646
THE MESSAGE : /* Class:requirement_mgr - Method: create_new_revision */ UPDATE req_versions SET revision = 2, log_message=' ', creation_ts = '2016-09-13 14:25:09' ,author_id = 2, modifier_id = NULL, modification_ts = NULL WHERE id = 118646 Query failed: errorcode[1048] errormsg:Column 'modification_ts' cannot be null
(0025408)
fman (administrator)
2016-09-14 17:27

@daronz
1) Reporter does not need to monitor his/her own issue.
(0025410)
daronz (reporter)
2016-09-14 18:05

I've temporarily fixed it.
File: testlink-code/lib/functions/database.class.php
Line: 889
- $nullValue = NULL;
+ $nullValue = " '0000-00-00 00:00:00' ";
(0025411)
fman (administrator)
2016-09-14 19:04
edited on: 2016-09-14 19:07

Just tested using XAMPP 5.6.3 on OSX (MySQL 5.6.21) => no issues.
Issue is related to MySQL Version.
Would you mind to provide MySQL Version? probably as happened to user mbar issue is due to changes on date & time columns, between MySQL Versions.

(0025412)
daronz (reporter)
2016-09-15 02:08

MySQL Version: 5.7.14
(0026150)
hguilherme66 (reporter)
2017-03-21 09:57

I am also getting this issue. I am using dev 1.9.17 (was having same problem with 1.9.16).
I tried to Edit Requirement (change number of coverage tests from 0 to 1) and got the same DB error.
I attach the HTML with the errors (and Event message).
I am using MySQL v. 5.7.17 on CentOS 6.8
(0026151)
fman (administrator)
2017-03-21 10:05

Use
temp fix

I've temporarily fixed it.
File: testlink-code/lib/functions/database.class.php
Line: 889
- $nullValue = NULL;
+ $nullValue = " '0000-00-00 00:00:00' ";
(0026152)
hguilherme66 (reporter)
2017-03-21 11:40
edited on: 2017-03-21 12:08

I managed to fix error by setting a not NULL nor Zero value. MySQL configuration has NO_ZERO_DATES. For reference see http://stackoverflow.com/questions/35565128/mysql-incorrect-datetime-value-0000-00-00-000000 [^]

File: testlink-code/lib/functions/database.class.php
Lines: >885
<code>
  function db_null_timestamp()
  {
    $db_type = $this->db->databaseType;
    // $nullValue = NULL;
    $nullValue = " '1970-01-01' ";

    switch($db_type)
    {
      case 'mysql':
        // is not an error i put single quote on value
        // $nullValue = " '0000-00-00 00:00:00' ";
        $nullValue = " '1970-01-01' ";
      break;
    }
    return $nullValue;
  }

</code>

----
This would cause the need to call db_null_timestamp in all comparisons with NULL or Zero dates, at least in files: requirement_mgr.class.php and requirement_spec_mgr.class.php

<code>
[testlink@vm-testlink functions]$ grep -n 0000-00-00 requirement*
requirement_mgr.class.php:3075: // MySQL NULL DATE -> "0000-00-00 00:00:00"
requirement_mgr.class.php:3080: if( ($rs[$ap]['modification_ts'] != '0000-00-00 00:00:00') && !is_null($rs[$ap]['modification_ts']) )
requirement_spec_mgr.class.php:2066: // MySQL NULL DATE -> "0000-00-00 00:00:00"
requirement_spec_mgr.class.php:2071: if( ($rs[$ap]['modification_ts'] != '0000-00-00 00:00:00') && !is_null($rs[$ap]['modification_ts']) )
</code>

Existing data would also need to be migrated, for example:
UPDATE `req_versions` SET `modification_ts`='1970-01-01', `log_message`='reset field modification_ts' WHERE `modification_ts` < '1970-01-01';


- Issue History
Date Modified Username Field Change
2016-09-13 10:06 daronz New Issue
2016-09-13 10:06 daronz File Added: screenshot.zip
2016-09-13 10:24 mbar Note Added: 0025401
2016-09-13 11:45 mbar Note Added: 0025402
2016-09-13 12:16 mbar Note Added: 0025403
2016-09-13 12:19 mbar Note Added: 0025404
2016-09-13 12:27 mbar Note Added: 0025405
2016-09-14 17:27 fman Note Added: 0025408
2016-09-14 18:05 daronz Note Added: 0025410
2016-09-14 19:04 fman Note Added: 0025411
2016-09-14 19:07 fman Note Edited: 0025411 View Revisions
2016-09-15 02:08 daronz Note Added: 0025412
2017-03-21 09:57 hguilherme66 Note Added: 0026150
2017-03-21 09:58 hguilherme66 File Added: bug_on_testlink_lib_requirements_reqEdit.php.html.zip
2017-03-21 10:05 fman Note Added: 0026151
2017-03-21 11:40 hguilherme66 Note Added: 0026152
2017-03-21 11:40 hguilherme66 Note Edited: 0026152 View Revisions
2017-03-21 12:08 hguilherme66 Note Edited: 0026152 View Revisions



Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker