MantisBT

View Issue Details Jump to Notes ] Wiki ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012112mantisbtplug-inspublic2010-06-24 11:592013-04-06 09:23
Reporterdocteur.cox 
Assigned Todregad 
PrioritynormalSeverityblockReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version1.2.1 
Target Version1.2.12Fixed in Version1.2.12 
Summary0012112: XML Import fails: Column 'profile_id' cannot be null
DescriptionXML import fails with the following error message :
APPLICATION ERROR 0000401

Échec de la requête de base de données. L'erreur renvoyée par la base de données était #1048 : Column 'profile_id' cannot be null pour la requête : INSERT INTO mantis_bug_table
( project_id,reporter_id, handler_id,duplicate_id,
priority,severity, reproducibility,status,
resolution,projection, category_id,date_submitted,
last_updated,eta, bug_text_id,
os, os_build,platform, version,build,
profile_id, summary, view_state, sponsorship_total, sticky, fixed_in_version,
target_version, due_date
)
VALUES
( ?,?,?,?,
?,?,?,?,
?,?,?,?,
?,?,?,?,
?,?,?,?,
?,?,?,?,
?,?,?,?).
Tags2.0.x check, custom fields, summary
Attached Files

- Relationships
related to 0015721new Functionality to consider porting to master-2.0.x 
has duplicate 0012123closeddhx Import/Export 1.0 error 401 
has duplicate 0012842closedatrol XmlExportImport - Import XML failed 

-  Notes
User avatar (0025975)
docteur.cox (reporter)
2010-06-24 12:03

Export function does not include any profile information in the exported data.
As a consequence, the "profile_id" field of the BugData created during import is never initialized, while the database table constraints state that it must be not null.
User avatar (0026294)
KarlReichert (reporter)
2010-08-12 08:07
edited on: 2010-08-12 08:07

I can confirm that. This bug is a duplicate of bug 0012123, by the way.

User avatar (0026312)
dhx (developer)
2010-08-14 01:23

Can someone check if the latest nightly snapshot of MantisBT 1.3.x resolves this issue? Issue 0012013 improved the XML import/export functionality a great deal.

Thanks
User avatar (0026330)
KarlReichert (reporter)
2010-08-16 05:44

I installed the current nightly build to test that, but I can't login into this build:

APPLICATION ERROR #2900
For security reasons MantisBT will not operate when $g_crypto_master_salt is not specified correctly in config_inc.php.
Please use the "Back" button in your web browser to return to the previous page. There you can correct
whatever problems were identified in this error or select another action. You can also click an option
from the menu bar to go directly to a new section.

I cannot find a solution for that. Can someone help me? Than I can test the new Im-/Export.
User avatar (0026712)
dhx (developer)
2010-09-14 09:38

The latest version of the manual contains information on how to set $g_crypto_master_salt.

Basically just set it to a completely random string (20+ characters) inside config_defaults_inc.pgp
User avatar (0026730)
wkarl (reporter)
2010-09-16 02:35

This only occurs to issues that contain the value 0 (zero) in the "profile_id" field. If the field has a different value, it is exported.

The problem is the following code in plugins/XMLImportExport/export.php :
[code]
    foreach( $t_columns as $t_element ) {
        $t_value = $t_row->$t_element;
        if( empty( $t_value ) ) {
            continue;
        }
[/code]

The empty() function returns FALSE, if the field's value is 0 (zero).


This is an excerpt of the PHP manual, empty() function:
[excerpt]
 Returns FALSE if var has a non-empty and non-zero value.

The following things are considered to be empty:

    * "" (an empty string)
    * 0 (0 as an integer)
    * "0" (0 as a string)
    * NULL
    * FALSE
    * array() (an empty array)
    * var $var; (a variable declared, but without a value in a class)
[/excerpt]

Thus, variables containing 0 (zero) are considered empty.

This might also be a problem for other fields containing 0 (zero) values.

I modified the code above to:

[code]
    foreach( $t_columns as $t_element ) {
        $t_value = $t_row->$t_element;
        if( strval( $t_value ) == "" ) {
            continue;
        }
[/code]

and it seems to work, I can not say if there are other problems with this code, though.
User avatar (0026753)
dhx (developer)
2010-09-17 21:59

It seems that the exporter is currently designed not to export properties that have empty/null values. Thus the importer should be detecting missing fields in the XML file and filling them with default values (taking into account the defaults set in config_defaults_inc.php).

Thus I think the fixes need to be made to the import side of the plugin to resolve this issue?
User avatar (0031105)
michield (reporter)
2012-02-02 08:57

I stumbled upon this problem, and looked into the DB

I found all my issues have "profile_id" 0, so I just did

"alter table mantis_bug_table change column profile_id profile_id int(7) unsigned default 0;"

and the import worked fine.
User avatar (0032864)
dregad (developer)
2012-09-18 09:39

This was already fixed in master as part of 0012013
User avatar (0036207)
grangeway (developer)
2013-04-05 17:56

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

- Related Changesets
MantisBT: master-1.2.x cb825352
Timestamp: 2012-09-18 05:51:37
Author: dregad
Details ] Diff ]
XmlImportExport: Fix import error "Column 'profile_id' cannot be null"

In bug_api.php BugData class, the profile_id member variable defaults to
null but the DB bug table does not allow null values, causing the error.

Defaulting the variable to 0 resolves the problem.

Fixes 0012112
mod - core/bug_api.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2010-06-24 11:59 docteur.cox New Issue
2010-06-24 12:03 docteur.cox Note Added: 0025975
2010-08-12 08:07 KarlReichert Note Added: 0026294
2010-08-12 08:07 KarlReichert Note Edited: 0026294 View Revisions
2010-08-12 08:45 dhx Relationship added has duplicate 0012123
2010-08-14 01:23 dhx Note Added: 0026312
2010-08-14 01:24 dhx Assigned To => dhx
2010-08-14 01:24 dhx Status new => feedback
2010-08-14 01:24 dhx Target Version => 1.2.3
2010-08-14 01:24 dhx Summary XML Import fails => XML Import fails: Column 'profile_id' cannot be null
2010-08-16 05:44 KarlReichert Note Added: 0026330
2010-08-16 07:08 pavan Tag Attached: custom fields
2010-08-16 07:08 pavan Tag Attached: summary
2010-08-16 07:08 pavan Tag Attached: kjlj
2010-09-14 09:38 dhx Note Added: 0026712
2010-09-14 10:55 jreese Target Version 1.2.3 => 1.2.4
2010-09-16 02:35 wkarl Note Added: 0026730
2010-09-17 21:59 dhx Note Added: 0026753
2010-12-14 21:05 jreese Target Version 1.2.4 => 1.2.5
2011-03-07 16:19 atrol Relationship added has duplicate 0012842
2011-04-05 12:25 jreese Target Version 1.2.5 => 1.2.6
2011-07-26 09:53 jreese Target Version 1.2.6 => 1.2.7
2011-08-22 10:49 jreese Target Version 1.2.7 => 1.2.8
2011-09-06 10:33 jreese Target Version 1.2.8 => 1.2.9
2012-02-02 08:57 michield Note Added: 0031105
2012-03-04 09:23 atrol Target Version 1.2.9 => 1.2.10
2012-04-02 02:33 atrol Target Version 1.2.10 => 1.2.11
2012-06-06 23:54 jreese Target Version 1.2.11 => 1.2.12
2012-09-18 09:37 dregad Changeset attached => MantisBT master-1.2.x cb825352
2012-09-18 09:37 dregad Assigned To dhx => dregad
2012-09-18 09:37 dregad Status feedback => resolved
2012-09-18 09:37 dregad Resolution open => fixed
2012-09-18 09:37 dregad Fixed in Version => 1.2.12
2012-09-18 09:39 dregad Note Added: 0032864
2012-10-05 15:16 atrol Tag Detached: kjlj
2012-11-10 18:54 dregad Status resolved => closed
2013-04-05 17:56 grangeway Status closed => acknowledged
2013-04-05 17:56 grangeway Note Added: 0036207
2013-04-05 18:58 grangeway Relationship added related to 0015721
2013-04-06 03:40 dregad Status acknowledged => closed
2013-04-06 07:23 grangeway Status closed => acknowledged
2013-04-06 09:22 dregad Tag Attached: 2.0.x check
2013-04-06 09:23 dregad Status acknowledged => closed


MantisBT 1.2.16dev master-1.2.x-8c2bd07 [^]
Copyright © 2000 - 2013 MantisBT Team
Time: 0.1121 seconds.
memory usage: 2,909 KB
Powered by Mantis Bugtracker