View Issue Details

IDProjectCategoryView StatusLast Update
0036263mantisbtadministrationpublic2025-08-15 04:04
Reportervicsuarez Assigned Todregad  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.27.0 
Target Version2.27.2Fixed in Version2.27.2 
Summary0036263: Error editing categories with PostgreSQL: APPLICATION ERROR 401
Description

When submitting changes after editing a category (manage_proj_cat_update.php) MantisBT shows this error:

APPLICATION ERROR 401

Database query failed. Error received from database was #-1: ERROR: invalid input syntax for type integer: "TRUE" for the query: UPDATE mantis_category_table SET name=$1, user_id=$2, status=$3
WHERE id=$4.

Steps To Reproduce

Go "Manage" > "Projects" and then:

  • A) "Edit" a Global Category and immediately click "Update Category"
  • B) Click on an existing project > "Edit" a category and inmmediately click on "Update Category"
Additional Information

"manage_proj_cat_update.php" script passes a boolean value to "$p_status" parameter of "category_update" method in "category_api.php", but in PostgreSQL you have no automatic cast from a boolean value to an integer value ("status" field is a numeric type in "mantis_category_table").

TagsNo tags attached.

Relationships

related to 0031017 closeddregad Allow disabling Categories 

Activities

dregad

dregad

2025-08-14 03:40

developer   ~0070442

This is a regression introduced by 0031017.

category_update() expects $p_status parameter to be int|null so I believe there is a missing type cast in manage_proj_cat_update.php line 78.

I do not have access to a PostgreSQL instance at the moment so I can't test and confirm for sure. Until I do you may want to try this as a workaround, and let me know how it goes:

diff --git a/manage_proj_cat_update.php b/manage_proj_cat_update.php
index 4d715c206..bf8224470 100644
--- a/manage_proj_cat_update.php
+++ b/manage_proj_cat_update.php
@@ -75,7 +75,7 @@ if( mb_strtolower( $f_name ) != mb_strtolower( $t_old_name ) ) {
        category_ensure_unique( $t_project_id, $f_name );
 }

-category_update( $f_category_id, $f_name, $f_assigned_to, $f_status );
+category_update( $f_category_id, $f_name, $f_assigned_to, (int)$f_status );

 form_security_purge( 'manage_proj_cat_update' );
vicsuarez

vicsuarez

2025-08-14 04:02

reporter   ~0070443

Patch fixes the problem. Thank you.

atrol

atrol

2025-08-15 03:32

developer   ~0070444

Last edited: 2025-08-15 04:04

@dregad what do you think about reverting your change but changing
$f_status = gpc_get_bool( 'status', CATEGORY_STATUS_DISABLED );
to
$f_status = gpc_get_int( 'status', CATEGORY_STATUS_DISABLED );

Related Changesets

MantisBT: master-2.27 38a56985

2025-08-14 04:15

dregad


Details Diff
Fix DB error updating category on PostgreSQL

ERROR: invalid input syntax for type integer: "TRUE" for the query:
UPDATE mantis_category_table SET name=$1, user_id=$2, status=$3
WHERE id=$4.

Regression introduced by commit 05c1639f45bfc0c3392288930f37f351bfcfc7b9
(issue 0031017).

Fixes 0036263
Affected Issues
0031017, 0036263
mod - manage_proj_cat_update.php Diff File