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: -
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:
Status: Open Package: ibm_db2 (PECL)
PHP Version: 7.3.2 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

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
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri May 24 16:01:26 2019 UTC