Anonymous | Login | Signup for a new account | 2019-12-06 15:42 UTC | ![]() |
Main | My View | View Issues | Change Log | My Account |
View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0007150 | TestLink | Test Plan (builds, milestones, test assign) | public | 2015-06-05 13:34 | 2015-09-19 08:49 | ||||
Reporter | dstraube | ||||||||
Assigned To | fman | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | Linux | OS | Debian | OS Version | Debian 7.8 | ||||
Product Version | 1.9.13 (2015 #1) | ||||||||
Fixed in Version | 1.9.14 (2015 Q3) | ||||||||
Summary | 0007150: Copying builds without release date fails (POSTGRES) | ||||||||
Description | Version 1.9.13 has an issue with copying builds that do not have a release date set. It occurs when you try to copy a testplan including the builds and assignments. Output in event log: ERROR ON exec_query() - database.class.php 0 - - /* Class:testplan - Method: copy_builds */ INSERT INTO builds (name,notes,release_date,testplan_id) VALUES ('>18234','','', 50713) THE MESSAGE : /* Class:testplan - Method: copy_builds */ INSERT INTO builds (name,notes,release_date,testplan_id) VALUES ('>18234','','', 50713) Query failed: errorcode[0] errormsg: This is new in version 1.9.13, the previous version didn't take release dates into account. | ||||||||
Steps To Reproduce | Try to copy a testplan including builds that have no release_date defined. | ||||||||
Additional Information | The error is in /lib/functions/testplan.class.php: private function copy_builds($id,$new_tplan_id) { $debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__; $rs=$this->get_builds($id); $id_mapping = array(); if(!is_null($rs)) { foreach($rs as $build) { $sql = " /* $debugMsg */ INSERT INTO {$this->tables['builds']} " . " (name,notes,release_date,testplan_id) " . "VALUES ('" . $this->db->prepare_string($build['name']) ."'," . "'" . $this->db->prepare_string($build['notes']) . "'," . "'" . $this->db->prepare_string($build['release_date']) . "'," . " {$new_tplan_id})"; $this->db->exec_query($sql); $new_id = $this->db->insert_id($this->tables['builds']); $id_mapping[$build['id']] = $new_id; } } return $id_mapping; } The problem is the line that prepares the release_date string. When the columns is empty it will insert an empty string like this: INSERT INTO builds (name,notes,release_date,testplan_id) VALUES ('>18234','','', 50713) The database then complains: ERROR: invalid input syntax for type date: "" The column release_date has the type "date", so it should have been a NULL value instead of an empty string. The table is defined as: Table "public.builds" Column | Type | Modifiers ----------------+-----------------------------+----------------------------------------------------- id | bigint | not null default nextval('builds_id_seq'::regclass) testplan_id | bigint | not null default (0)::bigint name | character varying(100) | not null default 'undefined'::character varying notes | text | active | smallint | not null default (1)::smallint is_open | smallint | not null default (1)::smallint author_id | bigint | creation_ts | timestamp without time zone | not null default now() release_date | date | closed_on_date | date | | ||||||||
Tags | No tags attached. | ||||||||
Database (MySQL,Postgres,etc) | Postgres | ||||||||
Browser | Firefox 38.0.1 | ||||||||
PHP Version | PHP 5.4.4-14 | ||||||||
TestCaseID | |||||||||
QA Team - Task Workflow Status | READY FOR TESTING | ||||||||
Attached Files | |||||||||
![]() |
||||||
|
![]() |
|
(0023443) fman (administrator) 2015-06-05 17:13 |
thanks for help |
(0023444) fman (administrator) 2015-06-07 08:10 |
Tested with latest code from github 1) Create Test Project VERA (EMPTY no test suites, no test cases) 2) Create Test Project PA (Empty) 3) Create build 10 on Test Project PA, leave release date EMPTY 4) Create Test Project PB as copy of PA No issue |
(0023447) dstraube (reporter) 2015-06-08 08:51 |
Sorry, I should have provided more details about the way to reproduce the issue. It happens when you create a new testplan and create it from an existing one that has builds without release date attached to it. I've checked this again with the latest code base. Problem still exists. Here are the steps I did with a fresh installation using a POSTGRES database. 1) Create Test Project Testproject (EMPTY no test suites, no test cases) 2) Create Test Plan TP1 3) Select Test Plan TP1 and create a new Build for it, leave "Release date" field empty (default). 4) Go to Test Plan Management and create a new Test Plan 5) Enter TP2 as Name 6) Create from existing Test Plan: Choose TP1, leave everything else to default values. 7) Save and watch the error messages: ============================================================================== 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. ============================================================================== ============================================================================== ============================================================================== 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. ============================================================================== ============================================================================== |
(0023448) fman (administrator) 2015-06-08 09:05 |
OK, thanks, now I've got is postgres, and I've tested using MySQL I'm going to check on following days |
(0023455) fman (administrator) 2015-06-08 21:09 |
https://github.com/TestLinkOpenSourceTRMS/testlink-code/commit/e049b0608837270f9740a749ec0a439f26bd2f72 [^] |
(0023457) dstraube (reporter) 2015-06-09 06:42 |
Do you want that "echo $sql;" in line 1495 really in there? |
(0023459) fman (administrator) 2015-06-09 08:54 |
NO just a mistake. Important thing is to know if is fixed |
(0023460) dstraube (reporter) 2015-06-09 09:05 |
I've looked at the code and it will solve the problem. I've then tested it and it works fine. Both cases now work, for builds with release date and for those without. Thank you for the fast fix. |
(0023927) fman (administrator) 2015-09-19 08:49 |
1.9.14 Padawan - released - 2015-09-19 |
![]() |
|||
Date Modified | Username | Field | Change |
2015-06-05 13:34 | dstraube | New Issue | |
2015-06-05 17:13 | fman | Note Added: 0023443 | |
2015-06-07 08:10 | fman | Note Added: 0023444 | |
2015-06-07 08:11 | fman | QA Team - Task Workflow Status | => TBD |
2015-06-07 08:11 | fman | Fixed in Version | => 1.9.14 (2015 Q3) |
2015-06-07 08:11 | fman | Description Updated | View Revisions |
2015-06-07 08:11 | fman | Assigned To | => fman |
2015-06-07 08:11 | fman | Status | new => feedback |
2015-06-07 08:11 | fman | Relationship added | child of 0006830 |
2015-06-08 08:51 | dstraube | Note Added: 0023447 | |
2015-06-08 08:51 | dstraube | Status | feedback => assigned |
2015-06-08 09:05 | fman | Note Added: 0023448 | |
2015-06-08 09:06 | fman | Summary | Copying builds without release date fails => Copying builds without release date fails (POSTGRES) |
2015-06-08 21:09 | fman | QA Team - Task Workflow Status | TBD => READY FOR TESTING |
2015-06-08 21:09 | fman | Note Added: 0023455 | |
2015-06-08 21:09 | fman | Status | assigned => resolved |
2015-06-08 21:09 | fman | Resolution | open => fixed |
2015-06-09 06:42 | dstraube | Note Added: 0023457 | |
2015-06-09 08:54 | fman | Note Added: 0023459 | |
2015-06-09 09:05 | dstraube | Note Added: 0023460 | |
2015-09-19 08:49 | fman | Note Added: 0023927 | |
2015-09-19 08:49 | fman | Status | resolved => closed |
Copyright © 2000 - 2019 MantisBT Team |