Commit Graph

1067 Commits

Author SHA1 Message Date
Máté Kocsis
12799847a6
Merge branch 'PHP-8.0'
* Fix pg_get_notify() parameter name
2021-04-26 19:38:57 +02:00
Máté Kocsis
d1e590fe72
Fix pg_get_notify() parameter name
Closes GH-6916
2021-04-26 19:37:41 +02:00
Nikita Popov
ba337577a8 Use zend_string for pgsql_trim_message 2021-04-26 16:45:38 +02:00
Nikita Popov
f26047fc9b Don't store resolved pgsql field/table oids as resources
Store these in hash tables indexed by oid. This is simpler and
more efficient, as we don't need to create resources or hash keys.
2021-04-26 15:24:07 +02:00
Nikita Popov
8a283f7b87 Store pgsql le_string as zend_string 2021-04-26 15:01:44 +02:00
Christoph M. Becker
950bb84c7e
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix php_pgsql_fd_cast() wrt. php_stream_can_cast()
2021-04-20 18:32:05 +02:00
Christoph M. Becker
3c6480552d
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix php_pgsql_fd_cast() wrt. php_stream_can_cast()
2021-04-20 18:30:25 +02:00
Christoph M. Becker
1fcea24efb
Fix php_pgsql_fd_cast() wrt. php_stream_can_cast()
`php_stream_can_cast()` forwards to `_php_stream_cast()` with `ret` set
to `NULL`.  `php_pgsql_fd_cast()` needs to cater to that, because
otherwise the stream would report that it is not castable.

This *might* fix https://bugs.php.net/73903.

Closes GH-6888.
2021-04-20 18:29:12 +02:00
George Peter Banyard
612609e1bd
Refactor PGSQL extension to use zend_string*
* Prevents some unnecessary strlen() computation
 * Use interned "NULL"
 * Certain PGSQL_API functions now accept zend_string* instead of char*

Closes GH-6792
2021-04-19 20:33:40 +01:00
George Peter Banyard
0ffb4a5c9d
Boolify do_exec() 2021-04-19 20:33:05 +01:00
George Peter Banyard
fabcfd6d81
Formalize return type to zend_result for PGSQL_API functions 2021-04-19 20:33:05 +01:00
George Peter Banyard
6eb23e2b83
ValueError if lengths is less than 0 2021-04-19 20:27:34 +01:00
George Peter Banyard
13693aaf7e
Use ZEND_ASSERT() instead of plain assert() 2021-04-19 20:27:34 +01:00
George Peter Banyard
6569aedee3
Use ZEND_NUM_ARGS() explicitly 2021-04-19 20:27:34 +01:00
George Peter Banyard
a5fb43f2b1
Boolify _php_pgsql_link_has_results() 2021-04-19 20:27:34 +01:00
George Peter Banyard
8ae9922348
Boolify _php_pgsql_detect_identifier_escape() and rename it
New name is  _php_pgsql_identifier_is_escaped()
2021-04-19 20:27:34 +01:00
George Peter Banyard
7a1af523fa
Fix test output due to float to string locale independent change
Also use de_DE locale instead
2021-04-19 20:27:33 +01:00
Nikita Popov
0c5711856f Add zend_ulong_to_str() API
No point in going through a smart_str and append_unsigned if we
can construct the result directly...
2021-04-13 15:56:24 +02:00
George Peter Banyard
09efad615b
Use zend_string_equals_(literal_)ci() API more often
Also drive-by usage of zend_ini_parse_bool()

Closes GH-6844
2021-04-09 02:34:50 +01:00
George Peter Banyard
5caaf40b43
Introduce pseudo-keyword ZEND_FALLTHROUGH
And use it instead of comments
2021-04-07 00:46:29 +01:00
George Peter Banyard
48ac3881a3 Use zend_string_equals() API instead of strcmp() in PGSQL extension
And tiny drive by refactor at the same time for more usages
2021-03-17 16:36:16 +00:00
Máté Kocsis
bf0f6aaf18
Improve class entry generation
Related to GH-6701
2021-02-16 13:09:56 +01:00
Máté Kocsis
af56982a5e
Generate class entries from stubs for oci8, odbc, openssl, pcntl, pdo, pgsql
Closes GH-6691
2021-02-14 23:19:21 +01:00
Christoph M. Becker
882b418a01 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix locale dependent parsing of PostgreSQL version number
2021-02-08 19:01:42 +01:00
Christoph M. Becker
92f71d9d42 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix locale dependent parsing of PostgreSQL version number
2021-02-08 19:00:37 +01:00
Christoph M. Becker
03713ace23 Fix locale dependent parsing of PostgreSQL version number
Version numbers are not supposed to be localized, so we must not apply
locale dependent parsing with `atof()`.

Using `php_version_compare()` might even be better.

Closes GH-6668.
2021-02-08 18:57:08 +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
Nikita Popov
422d1665a2 Make convert_to_*_ex simple aliases of convert_to_*
Historically, the _ex variants separated the zval first, if a
conversion was necessary. This distinction no longer makes sense
since PHP 7.

The only difference that was still left is that _ex checked whether
the type is the same first, but the usage of these macros did not
actually distinguish on whether such an inlined check is valuable
or not in a given context.

Also drop the unused convert_to_explicit_type macros.
2021-01-14 12:11:11 +01:00
Nikita Popov
1b3b430f47 Add --repeat testing mode
This testing mode executes the test multiple times in the same
process (but in different requests). It is primarily intended to
catch tracing JIT bugs, but also catches state leaks across
requests.

Closes GH-6365.
2020-10-30 17:29:33 +01:00
Máté Kocsis
d5f92baad0 Fix default value handling of mysqli_fetch_object()
Make [] acceptable both for classes without constructors and
classes with a constructor that takes no arguments.

Closes GH-6336.
2020-10-20 16:48:12 +02:00
Máté Kocsis
d6264b0966
Verify parameter names of function aliases
Closes GH-6335
2020-10-16 10:56:33 +02:00
Nikita Popov
a7e84e2e02 Fix default value for some pgsql functions
These set the PGSQL_DML_EXEC flag by default.
2020-10-13 17:29:05 +02:00
Nikita Popov
7b0f5f424d Don't accept null in pg_unescape_bytea()
This is an error that slipped in via 8d37c37bcd.
pg_unescape_bytea() did not accept null in PHP 7.4, and it is not
meaningful for it to accept null now -- it will always fail, and now
with a misleading OOM message.
2020-10-13 15:37:13 +02:00
Nikita Popov
3171fec6da Update ext/pgsql parameter names
Closes GH-6294.
2020-10-13 12:30:44 +02:00
George Peter Banyard
e0b17ba219 Use a subrountine to check for valid OID strings
Closes 6260
2020-10-02 16:32:06 +01:00
George Peter Banyard
053a5fc141 Promote E_NOTICE to Value/TypeError in PostgreSQL extension
Add some tests to cover related codepaths.
With the small caveat that the ones in build_assignment_string()
still don't seem to be tested as it looks the condtions are checked
beforehand, might need some more investigation.

Closes GH-6226
2020-09-29 15:13:01 +01:00
Nikita Popov
8ff2f2f84b Return empty array for no rows in pg_fetch_all()
This makes it line up with pg_fetch_all_columns(), as well as
similar functions in other exts, such as mysqli_fetch_all().
2020-09-21 17:22:02 +02:00
Nikita Popov
54f03d31e0 Promote invalid field to ValueError in pgsql
The same error condition is a ValueError in mysqli, be consistent.

Additionally, do not display the argument name for these errors.
As the signatures are overloaded, the argument name may not match
the meaning at all.
2020-09-21 17:00:23 +02:00
Nikita Popov
68a907569c Remove redundant check
This was already checked directly above.
2020-09-21 17:00:22 +02:00
Nikita Popov
d1bbc39e4c pg_unescape_bytea() can only fail on OOM
The implementation did not check for PQunescapeBytea failure
correctly, because it checked for a null pointer after estrndup,
which certainly cannot happen. Inspection of the PGunescapeBytea
implementation has shown that this function can only fail on OOM,
so let's check for that explicitly and remove false as a possible
return type.

While we're here, avoid an unnecessary copy of the result.
2020-09-21 15:46:55 +02:00
Nikita Popov
7300f6fc17 Deprecate pgsql function aliases
These have been documentation-deprecated for a very long time,
make it official.
2020-09-21 11:33:05 +02:00
Máté Kocsis
8d37c37bcd
Fix a few UNKNOWN default values in ext/pgsql
Closes GH-6149
2020-09-17 11:00:59 +02:00
George Peter Banyard
d0111d785d Promote warnings to Errors in PostgreSQL extension
Do some drive by indentation fixes
Also fix pg_select() in regards to the $result_type arg which was missing from ZPP

Closes GH-6129
2020-09-14 17:01:35 +02:00
Nikita Popov
f29bfc0bd8 Use string|int union types in pgsql
For "field name or field offset" parameters.

Also make $ctor_params an ?array parameter.
2020-09-11 17:33:09 +02:00
Nikita Popov
68b21939ec Use proper int type for parameter 2020-09-09 17:18:58 +02:00
Nikita Popov
6145cac1af Fix default value 2020-09-09 17:14:14 +02:00
Nikita Popov
25d0e21d77 Use PGSQL_RETURN_OID() in more places 2020-09-09 17:09:40 +02:00
Nikita Popov
47688ab6d9 Add stub for pgsql extension 2020-09-09 16:47:10 +02:00
Nikita Popov
9a6c22da70 Remove deprecated pgsql signatures
As the comment indicates, these are deprecated in PHP 4.2...
2020-09-09 15:50:30 +02:00
Nikita Popov
8f415d4413 Promote pgsql no link to Error exception 2020-09-09 12:45:07 +02:00