MantisBT - TestLink
View Issue Details
0008678TestLinkTest Project Managementpublic2019-06-04 12:312019-06-08 20:33
heju 
fman 
normalcrashalways
resolvedfixed 
1.9.19 (2019 Q1) 
1.9.20 Raijing DEV 
MySql
READY FOR TESTING
0008678: ERROR ON exec_query() when creating new test project from existing test project
Dear TestLink Team,

when trying to create a new test project from an existing (big) project, I get a
DB Access Error.

Just above the "DB Access Error" error message, I can see some part of code displayed as text:
array(3) { ["copy_requirements"]=> int(1) ["copy_user_roles"]=> int(1) ["copy_platforms"]=> int(1) }

In the System Error log the following log entry appears:
ERROR ON exec_query() - database.class.php
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '3,4,'2019-06-04 13:38:42')' at line 2 - /* Class:testproject - Method: copy_as */ INSERT INTO req_relations (source_id, destination_id, relation_type, author_id, creation_ts) values (6863,,3,4,'2019-06-04 13:38:42')
THE MESSAGE : /* Class:testproject - Method: copy_as */ INSERT INTO req_relations (source_id, destination_id, relation_type, author_id, creation_ts) values (6863,,3,4,'2019-06-04 13:38:42') Query failed: errorcode[1064] errormsg:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '3,4,'2019-06-04 13:38:42')' at line 2
Full Error message displayed:
array(3) { ["copy_requirements"]=> int(1) ["copy_user_roles"]=> int(1) ["copy_platforms"]=> int(1) }

 ==============================================================================

 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:testproject - Method: copy_as */
                     INSERT INTO req_relations (source_id, destination_id, relation_type, author_id, creation_ts) values (7208,,3,4,'2019-06-04 14:11:11')) called at [/var/www/html/testlink-1.9.19/lib/functions/testproject.class.php:2697]
#1 testproject->copy_as(25, 7127, 4, copytest4, Array ([copy_requirements] => 1)) called at [/var/www/html/testlink-1.9.19/lib/project/projectEdit.php:422]
0000002 doCreate(stdClass Object ([tprojectName] => copytest4,[color] => ,[notes] => ,[doAction] => doCreate,[tcasePrefix] => cpt4,[api_key] => ,[tprojectID] => 0,[copy_from_tproject_id] => 25,[is_public] => 1,[
No tags attached.
child of 0008549assigned fman Availables hot-fixes for 1.9.19 & How To get full fixed package from GitHub 
png tprojCopy_screenshot.png (16,008) 2019-06-07 07:47
http://mantis.testlink.org/file_download.php?file_id=5158&type=bug
png

jpg tl_req_setup.jpg (231,118) 2019-06-08 09:58
http://mantis.testlink.org/file_download.php?file_id=5159&type=bug
jpg
Issue History
2019-06-04 12:31hejuNew Issue
2019-06-05 08:29fmanQA Team - Task Workflow Status => TBD
2019-06-05 08:29fmanAdditional Information Updatedbug_revision_view_page.php?rev_id=5857#r5857
2019-06-05 08:29fmanNote Added: 0028889
2019-06-05 11:37hejuNote Added: 0028891
2019-06-05 11:50hejuNote Edited: 0028891bug_revision_view_page.php?bugnote_id=28891#r5859
2019-06-05 21:39fmanNote Added: 0028899
2019-06-06 05:20hejuNote Added: 0028903
2019-06-06 09:23fmanNote Added: 0028904
2019-06-07 07:47hejuNote Added: 0028906
2019-06-07 07:47hejuFile Added: tprojCopy_screenshot.png
2019-06-07 07:49hejuNote Edited: 0028906bug_revision_view_page.php?bugnote_id=28906#r5863
2019-06-08 08:30hejuNote Added: 0028908
2019-06-08 09:25fmanNote Edited: 0028908bug_revision_view_page.php?bugnote_id=28908#r5865
2019-06-08 09:26fmanNote Added: 0028909
2019-06-08 09:57hejuNote Added: 0028911
2019-06-08 09:58hejuFile Added: tl_req_setup.jpg
2019-06-08 09:59hejuNote Edited: 0028911bug_revision_view_page.php?bugnote_id=28911#r5867
2019-06-08 10:40hejuNote Edited: 0028911bug_revision_view_page.php?bugnote_id=28911#r5868
2019-06-08 13:54fmanNote Added: 0028913
2019-06-08 13:54fmanQA Team - Task Workflow StatusTBD => READY FOR TESTING
2019-06-08 13:54fmanStatusnew => resolved
2019-06-08 13:54fmanFixed in Version => 1.9.20 Raijing DEV
2019-06-08 13:54fmanResolutionopen => fixed
2019-06-08 13:54fmanAssigned To => fman
2019-06-08 13:55fmanRelationship addedchild of 0008549
2019-06-08 20:33hejuNote Added: 0028916

Notes
(0028889)
fman   
2019-06-05 08:29   
please get branch 1.9.19.01, do fresh install, retest and provide feedback
(0028891)
heju   
2019-06-05 11:37   
(edited on: 2019-06-05 11:50)
I checked out the branch you suggested (last commit is 370d60577cd13c2b1e586496dc9dc1dd4de85e30).

(Using a duplicate of the data base, same procedure as for TL update. Was this the correct way you suggested?)

Error remains the same:

ERROR ON exec_query() - database.class.php
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '3,4,'2019-06-05 13:29:30')' at line 2 - /* Class:testproject - Method: copy_as */ INSERT INTO req_relations (source_id, destination_id, relation_type, author_id, creation_ts) values (8274,,3,4,'2019-06-05 13:29:30')
THE MESSAGE : /* Class:testproject - Method: copy_as */ INSERT INTO req_relations (source_id, destination_id, relation_type, author_id, creation_ts) values (8274,,3,4,'2019-06-05 13:29:30') Query failed: errorcode[1064] errormsg:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '3,4,'2019-06-05 13:29:30')' at line 2

(0028899)
fman   
2019-06-05 21:39   
please confirm that you have done fresh install => you start with a db without no data
(0028903)
heju   
2019-06-06 05:20   
Ah understood, I tried the TL branch version using the already populated db.

In case the problem is caused by problematic content in the database, how would I transfer all the data from the (maybe) broken db to the fresh install w/o copying the problematic content? From the error message, is there a chance to find out what db content is wrong, then I can try to fix it manually in mysql.
(0028904)
fman   
2019-06-06 09:23   
Trying to fix manually will be not easy, best way to go is to install a system in parallel and restart the migration process.

Please give me a couple of days to understand if I can reproduce the issue

regards
(0028906)
heju   
2019-06-07 07:47   
(edited on: 2019-06-07 07:49)
Dear fman,

I was able to copy the project w/o error message by using the following approach.

I noticed that the problem seems to be related to requirement relations.
By investigating the specific IDs stated in the db error messages it seemed that only links to requirements are affected that I recently:
- set to obsolete
- moved to some other requirement spec (the yellow folder symbol)

Now I just deleted all relations to the anyway obsolete reqs and I can copy the project again w/o the db error message.

One issue remains, not sure if it is problematic: I still see some part of php code in the GUI, directly after copying a project (this happens even when copying a completely unrelated testproject), I will attach a screenshot.

Best regards


edit: Screen-shot is attached above.

(0028908)
heju   
2019-06-08 08:30   
(edited on: 2019-06-08 09:25)
Small update:
Was able to reproduce the problem on a new installation of 1.9.17 (actually I planned to upgrade to 1.9.19 to check if this causes the problem, but was not necessary)

Steps to reproduce:
- create two requirement folders
- create one requirement in each folder
- add relation "related to" linking the two reqs in different folders
- try to generate a new project from the testproject (check requirements of course)

 ==============================================================================

 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:testproject - Method: copy_as */ INSERT INTO req_relations (source_id, destination_id, relation_type, author_id, creation_ts) values (,120,3,1,'2019-06-08 10:26:02')) called at [/var/www/html/testlink-1.9.17/lib/functions/testproject.class.php:2708]
#1 testproject->copy_as(1, 117, 1, cpy7, Array ([copy_requirements] => 1)) called at [/var/www/html/testlink-1.9.17/lib/project/projectEdit.php:474]
0000002 doCreate(stdClass Object ([tprojectName] => cpy7,[color] => ,[notes] => ,[doAction] => doCreate,[tcase

(0028909)
fman   
2019-06-08 09:26   
Hi
thanks, but that the issue is on 1.9.17 is not any help for me, Because I'm going to fix it only if present on 1.9.19
(0028911)
heju   
2019-06-08 09:57   
(edited on: 2019-06-08 10:40)
Hi,
understood. Did a fresh install of 1.9.19.01 (from git).
New database.

Was able to reproduce on first try. Steps as described above. I will add a screenshot showing the req folder structure.
-create folder structure as described.
-try to copy test project (incl reqs)


edit: added screenshot: http://mantis.testlink.org/file_download.php?file_id=5159&type=bug [^]


edit2: tested a fresh install of tl 1.9.20: bug can be still reproduced.

(0028913)
fman   
2019-06-08 13:54   
https://github.com/TestLinkOpenSourceTRMS/testlink-code/commit/132539f13e82bb748c976911dc22f493037bb741 [^]
(0028916)
heju   
2019-06-08 20:33   
Tested latest version from git. Works as expected.

Thank you very much for fixing!

Nice weekend & best regards