Permalink
Browse files

Revert use of (bool) typecast

Commit 5458f70 replaced several
occurences of db_prepare_bool() by (bool) typecasts. This breaks
compatibility with PostgreSQL, which requires special handling for
BOOLEAN columns.
  • Loading branch information...
1 parent ae288b0 commit adafb1c2647fef02ff4e82c3a207fae873e82236 @dregad dregad committed Jul 7, 2014
Showing with 12 additions and 12 deletions.
  1. +1 −1 api/soap/mc_api.php
  2. +1 −1 core/filter_api.php
  3. +3 −3 core/project_api.php
  4. +2 −2 core/user_api.php
  5. +2 −2 core/version_api.php
  6. +1 −1 library/adodb
  7. +2 −2 manage_user_update.php
View
@@ -545,7 +545,7 @@ function mci_filter_db_get_available_queries( $p_project_id = null, $p_user_id =
AND (is_public = " . db_param() . "
OR user_id = " . db_param() . ")
ORDER BY is_public DESC, name ASC";
- $t_result = db_query_bound( $t_query, array( $t_project_id, true, $t_user_id ) );
+ $t_result = db_query_bound( $t_query, array( $t_project_id, db_prepare_bool( true ), $t_user_id ) );
$t_query_count = db_num_rows( $t_result );
for( $i = 0;$i < $t_query_count;$i++ ) {
View
@@ -4780,7 +4780,7 @@ function filter_db_get_available_queries( $p_project_id = null, $p_user_id = nul
AND (is_public = " . db_param() . "
OR user_id = " . db_param() . ")
ORDER BY is_public DESC, name ASC";
- $t_result = db_query_bound( $t_query, array( $t_project_id, true, $t_user_id ) );
+ $t_result = db_query_bound( $t_query, array( $t_project_id, db_prepare_bool( true ), $t_user_id ) );
$t_query_count = db_num_rows( $t_result );
for( $i = 0; $i < $t_query_count; $i++ ) {
View
@@ -331,7 +331,7 @@ function validate_project_file_path( $p_file_path ) {
* @return integer
*/
function project_create( $p_name, $p_description, $p_status, $p_view_state = VS_PUBLIC, $p_file_path = '', $p_enabled = true, $p_inherit_global = true ) {
- $c_enabled = (bool)$p_enabled;
+ $c_enabled = db_prepare_bool( $p_enabled );
if( is_blank( $p_name ) ) {
trigger_error( ERROR_PROJECT_NAME_INVALID, ERROR );
@@ -423,8 +423,8 @@ function project_delete( $p_project_id ) {
*/
function project_update( $p_project_id, $p_name, $p_description, $p_status, $p_view_state, $p_file_path, $p_enabled, $p_inherit_global ) {
$p_project_id = (int)$p_project_id;
- $c_enabled = (bool)$p_enabled;
- $c_inherit_global = (bool)$p_inherit_global;
+ $c_enabled = db_prepare_bool( $p_enabled );
+ $c_inherit_global = db_prepare_bool( $p_inherit_global );
if( is_blank( $p_name ) ) {
trigger_error( ERROR_PROJECT_NAME_INVALID, ERROR );
View
@@ -536,7 +536,7 @@ function user_create( $p_username, $p_password, $p_email = '',
$t_password = auth_process_plain_password( $p_password );
- $c_enabled = (bool)$p_enabled;
+ $c_enabled = db_prepare_bool( $p_enabled );
user_ensure_name_valid( $p_username );
user_ensure_name_unique( $p_username );
@@ -560,7 +560,7 @@ function user_create( $p_username, $p_password, $p_email = '',
# Users are added with protected set to FALSE in order to be able to update
# preferences. Now set the real value of protected.
if( $p_protected ) {
- user_set_field( $t_user_id, 'protected', (bool)$p_protected );
+ user_set_field( $t_user_id, 'protected', db_prepare_bool( $p_protected ) );
}
# Send notification email
View
@@ -261,7 +261,7 @@ function version_update( VersionData $p_version_info ) {
$c_old_version_name = $t_old_version_name;
$c_description = $p_version_info->description;
$c_released = (int)$p_version_info->released;
- $c_obsolete = (bool)$p_version_info->obsolete;
+ $c_obsolete = db_prepare_bool( $p_version_info->obsolete );
$c_date_order = $p_version_info->date_order;
$c_project_id = (int)$p_version_info->project_id;
@@ -479,7 +479,7 @@ function version_get_all_rows( $p_project_id, $p_released = null, $p_obsolete =
if( $p_obsolete !== null ) {
$t_query .= " AND obsolete = " . db_param();
- $t_query_params[] = (bool)$p_obsolete;
+ $t_query_params[] = db_prepare_bool( $p_obsolete );
}
$t_query .= " ORDER BY date_order DESC";
Submodule adodb updated 114 files
View
@@ -125,8 +125,8 @@
$c_email = $t_email;
$c_username = $f_username;
$c_realname = $t_realname;
-$c_protected = (bool)$f_protected;
-$c_enabled = (bool)$f_enabled;
+$c_protected = db_prepare_bool( $f_protected );
+$c_enabled = db_prepare_bool( $f_enabled );
$c_user_id = (int)$f_user_id;
$c_access_level = (int)$f_access_level;

0 comments on commit adafb1c

Please sign in to comment.