php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77591 db2_autocommit() expects boolean, but DB2_AUTOCOMMIT_ON/OFF are of type int
Submitted: 2019-02-09 02:32 UTC Modified: 2021-07-28 15:27 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: bugs dot php dot net at majkl578 dot cz Assigned: cmb (profile)
Status: Closed Package: ibm_db2 (PECL)
PHP Version: 7.3.2 OS:
Private report: No CVE-ID: None
 [2019-02-09 02:32 UTC] bugs dot php dot net at majkl578 dot cz
Description:
------------
Documentation suggests to use db2_autocommit() with either DB2_AUTOCOMMIT_OFF or DB2_AUTOCOMMIT_ON constant. However the function expects 2nd argument of type bool while the constants are of type int.

This produces a TypeError in declare(strict_types=1) mode.

Test script:
---------------
<?php

declare(strict_types=1);

$c = db2_connect('xxx', 'xxx', 'xxx');

db2_autocommit($c, DB2_AUTOCOMMIT_OFF);

Expected result:
----------------
No error - DB2_AUTOCOMMIT_OFF/DB2_AUTOCOMMIT_ON should be accepted.

Actual result:
--------------
TypeError: db2_autocommit() expects parameter 2 to be boolean, integer given

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-02-19 23:13 UTC]
The following pull request has been associated:

Patch Name: Make SQL_AUTOCOMMIT_ON and SQL_AUTOCOMMIT_OFF boolean types
On GitHub:  https://github.com/php/pecl-database-ibm_db2/pull/8
Patch:      https://github.com/php/pecl-database-ibm_db2/pull/8.patch
 [2019-05-08 09:55 UTC] vnkbabu@php.net
Hi,
   thanks for bringing this issue into our notice. We will consider this issue when we release the next version. For now, is it possible to use boolean values ? true and false
 [2021-07-28 15:27 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-07-28 15:27 UTC] cmb@php.net
The pull request has been merged long ago, so this issue should be
resolved.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC