Commit graph

402 commits

Author SHA1 Message Date
Calvin Buckley
5a2b251610 Fix persistent procedural ODBC connections not getting closed
Like oci8, procedural ODBC uses an apply function on the hash list to
enumerate persistent connections and close the specific one. However,
this function take zvals, not resources. However, it was getting casted
as such, causing it to interpret the pointer incorrectly. This could
have caused other issues, but mostly manifested as failing to close the
connection even fi it matched.

The function now takes a zval and gets the resource from that. In
addition, it also removes the cast of the function pointer and moves
casting to the function body, to avoid possible confusion like this in
refactors again. It also cleans up style and uses constants in the
function body.

Closes GH-12132

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-09-06 01:55:02 +01:00
Calvin Buckley
a022ec53bd Fix memory leak with failed SQLPrepare
Closes GH-12095

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-09-02 23:00:06 +01:00
Christoph M. Becker
4b8bbfb6db
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix handling of single-key connection strings
2022-06-13 14:43:51 +02:00
Calvin Buckley
445d9502bf
Fix handling of single-key connection strings
A connection string may contain just a single key, but
PHP used ";" as the heuristic to detect if a string was a connection
string versus plain DSN. However, a single-key connection string
would get treated like a DSN name, i.e. "DSN=*LOCAL". This makes it
so that "=" is used, as a connection string must contain a key.

Closes GH-8748.
2022-06-13 14:41:50 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Nikita Popov
bd2c743f1d Merge branch 'PHP-8.0'
* PHP-8.0:
  Remove incorrect format argument
2021-04-27 22:23:22 +02:00
Nikita Popov
9ce5776922 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Remove incorrect format argument
2021-04-27 22:23:06 +02:00
Nikita Popov
3f71ba2611 Remove incorrect format argument
rc is not used by the printf format.
2021-04-27 22:22:32 +02:00
Christoph M. Becker
7be5e78dab
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80460: ODBC doesn't account for SQL_NO_TOTAL indicator
2021-04-27 17:12:58 +02:00
Christoph M. Becker
4c80e439a8
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80460: ODBC doesn't account for SQL_NO_TOTAL indicator
2021-04-27 17:12:01 +02:00
Christoph M. Becker
7f83976200
Fix #80460: ODBC doesn't account for SQL_NO_TOTAL indicator
The `StrLen_or_IndPtr` parameter usually may be `SQL_NO_TOTAL`; we need
to cater to that possibility to avoid working with negative string
lengths and other issues.  A noteable exemption are calls to
`SQLGetData()` which return `SQL_SUCCESS`; in that case `SQL_NO_TOTAL`
can not occur.

Closes GH-6809.
2021-04-27 17:09:36 +02:00
George Peter Banyard
5caaf40b43
Introduce pseudo-keyword ZEND_FALLTHROUGH
And use it instead of comments
2021-04-07 00:46:29 +01:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
Christoph M. Becker
f674a3343c Fix #80592: all floats are the same in ODBC parameters
We must not release the strings until we are done with them.

Closes GH-6579.
2021-01-06 13:56:02 +01:00
Christoph M. Becker
489b5328c0 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix format specifier
2020-10-29 13:10:32 +01:00
Christoph M. Becker
dd97cb1665 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix format specifier
2020-10-29 13:09:19 +01:00
Christoph M. Becker
ee3227af48 Fix format specifier
In this function, `i` is of type `size_t`.
2020-10-29 13:08:16 +01:00
Christoph M. Becker
9838eff68b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #44618: Fetching may rely on uninitialized data
2020-10-29 12:03:11 +01:00
Christoph M. Becker
133ac0151b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #44618: Fetching may rely on uninitialized data
2020-10-29 12:00:57 +01:00
Christoph M. Becker
c21e901ba7 Fix #44618: Fetching may rely on uninitialized data
Unless `SQLGetData()` returns `SQL_SUCCESS` or `SQL_SUCCESS_WITH_INFO`,
the `StrLen_or_IndPtr` output argument is not guaranteed to be properly
set.  Thus we handle retrieval failure other than `SQL_ERROR` by
yielding `false` for those column values and raising a warning.

Closes GH-6281.
2020-10-29 11:59:12 +01:00
Christoph M. Becker
8d4774a2df Change parameters types from int to bool
These are typical boolean parameters, so we shouldn't advertize them as
integers.  For the `$reverse` parameter that even fixes expectations,
because the `reverse` member is a bitfield of 1 bit, so assigning any
even integer would not set it.

Closes GH-6328.
2020-10-12 23:10:13 +02:00
Christoph M. Becker
3eae7aa77e Don't separate array parameter
Closes GH-6243.
2020-10-05 23:11:36 +02:00
Christoph M. Becker
9fe5479eeb Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #46050: odbc_next_result corrupts prepared resource
2020-10-05 17:48:44 +02:00
Christoph M. Becker
c6e7969f05 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #46050: odbc_next_result corrupts prepared resource
2020-10-05 17:47:35 +02:00
Christoph M. Becker
69ba81d183 Fix #46050: odbc_next_result corrupts prepared resource
When resetting the result's values, we also have to reset its numcols.
2020-10-05 17:46:37 +02:00
Christoph M. Becker
07fa13088e Revert "Use external iterator instead of via the internal pointer"
This reverts commit a6ecafece9.

Closes GH-6242.
2020-09-30 01:23:16 +02:00
Christoph M. Becker
a1ee3c74d1 Fix recently introduced off-by-one error 2020-09-29 18:46:07 +02:00
Nikita Popov
82f0d3c181 Remove unused variable 2020-09-29 12:35:39 +02:00
Christoph M. Becker
a6ecafece9 Use external iterator instead of via the internal pointer 2020-09-29 11:41:17 +02:00
Christoph M. Becker
a0051be42a Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #80152: odbc_execute() moves internal pointer of $params
2020-09-29 11:36:54 +02:00
Christoph M. Becker
b87e43d931 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80152: odbc_execute() moves internal pointer of $params
2020-09-29 11:35:41 +02:00
Christoph M. Becker
bf5f07cc8b Fix #80152: odbc_execute() moves internal pointer of $params
As least intrusive fix, we separate the passed array argument.

Closes GH-6219.
2020-09-29 11:34:48 +02:00
Christoph M. Becker
9f5a77188c Fix #22986: odbc_connect() may reuse persistent connection
`odbc_connect()` should not reuse persistent connections, since that
prohibits multiple concurrent connections, which are occasionally
desireable.  We fix that by no longer looking for already cached
connections when `odbc_connect()` is called, and instead creating a new
connection instead.

Closes GH-6223.
2020-09-29 11:20:41 +02:00
Christoph M. Becker
5f5eba1d7a Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #80150: Failure to fetch error message
2020-09-29 11:05:31 +02:00
Christoph M. Becker
e08f69194c Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80150: Failure to fetch error message
2020-09-29 11:04:09 +02:00
Christoph M. Becker
df5efa2fcd Fix #80150: Failure to fetch error message
In case of statement related errors, we need to pass the respective
statement handle to `SQLError()`.

Closes GH-6217.
2020-09-29 11:02:51 +02:00
Christoph M. Becker
3d148804cc Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #80147: BINARY strings may not be properly zero-terminated
2020-09-25 13:53:19 +02:00
Christoph M. Becker
1086e4ec88 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80147: BINARY strings may not be properly zero-terminated
2020-09-25 13:52:08 +02:00
Christoph M. Becker
a49555a9e1 Fix #80147: BINARY strings may not be properly zero-terminated
We have to manually ensure that all strings fetched from a data source
are zero-terminated.

Closes GH-6213.
2020-09-25 13:51:18 +02:00
Máté Kocsis
9b50fd2626
Fix UNKNOWN default values in ext/odbc
Closes GH-6154
2020-09-24 22:17:04 +02:00
Christoph M. Becker
555e7eccc4 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #78470: odbc_specialcolumns() no longer accepts $nullable
2020-09-24 12:23:37 +02:00
Christoph M. Becker
901d022001 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78470: odbc_specialcolumns() no longer accepts $nullable
2020-09-24 12:16:54 +02:00
Christoph M. Becker
610e7d2c77 Fix #78470: odbc_specialcolumns() no longer accepts $nullable
It is mandatory to pass either `SQL_NO_NULLS` or `SQL_NULLABLE` as
tenth parameter to `SQLSpecialColumns()`; otherwise the function call
fails.  Therefore the user must be allowed to pass the desired value
as parameter to `odbc_specialcolumns()` again.

Closes GH-6200.
2020-09-24 12:15:59 +02:00
Nikita Popov
d4e5b5b6fc Fix compilation warnings in odbc
SQLCHAR* cast all the things.
2020-09-17 12:52:31 +02:00
George Peter Banyard
c1823c6c8a Promote warning to Error in ODBC extension
Closes GH-6123
2020-09-15 12:50:00 +02:00
Máté Kocsis
3e800e997b
Move custom type checks to ZPP
Closes GH-6034
2020-09-02 11:11:38 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Dmitry Stogov
2423288f0f Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed possible usage of uninitialized value
2020-05-27 11:27:34 +03:00
Dmitry Stogov
886a34b1cc Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed possible usage of uninitialized value
2020-05-27 11:26:25 +03:00