Commit Graph

1024 Commits

Author SHA1 Message Date
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
Nikita Popov
3ab88831ae Remove deprecated multi-parameter form of pg_connect() 2020-09-09 12:31:00 +02:00
George Peter Banyard
1b2ec73c1d Drop various unused macros/APIs
Also convert_libmagic_pattern() to return a zend_string*

Closes GH-6029
2020-08-26 12:59:43 +02:00
Nikita Popov
396b47061f Use zpp C in pg_fetch_object 2020-08-13 16:24:08 +02:00
Máté Kocsis
7aacc705d0
Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
Nikita Popov
d92229d8c7 Implement named parameters
From an engine perspective, named parameters mainly add three
concepts:

 * The SEND_* opcodes now accept a CONST op2, which is the
   argument name. For now, it is looked up by linear scan and
   runtime cached.
 * This may leave UNDEF arguments on the stack. To avoid having
   to deal with them in other places, a CHECK_UNDEF_ARGS opcode
   is used to either replace them with defaults, or error.
 * For variadic functions, EX(extra_named_params) are collected
   and need to be freed based on ZEND_CALL_HAS_EXTRA_NAMED_PARAMS.

RFC: https://wiki.php.net/rfc/named_params

Closes GH-5357.
2020-07-31 15:53:36 +02:00
Nikita Popov
6ff31eebb1 Fix some pgsql arginfos
And make sure too few/many arguments throws, to satisfy the
function signature.
2020-07-17 15:43:37 +02:00
Nikita Popov
658e861fbb Some zpp cleanup in pgsql 2020-07-17 15:31:22 +02:00
Nikita Popov
a20f07ee59 Remove some zpp quiet uses in pgsql
These functions don't do anything special, just use normal zpp.
2020-07-17 15:24:46 +02:00
Nikita Popov
302933daea Remove no_separation flag 2020-07-07 09:30:24 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Christoph M. Becker
ce668c0ec6 PGSQL and POD_SQL: don't include pg_config.h
Even if that header file is available, we better consider it private,
and don't include it.  The information about whether SSL support is
enabled is now missing (`USE_(OPEN)SSL`), and it seems there is no
alternative way to get it (`PQinitSSL()` is always defined), so we
remove it from the PHP info.  Furthermore, the `PG_VERSION` and
`PG_VERSION_STR` macros are no longer available, but as of libpq 9.1
there is `PQlibVersion()` which allows us to construct `PG_VERSION` in
a most likely backwards compatible manner.  The additional information
available through `PG_VERSION_STR` is lost, though, so we define
`PGSQL_LIBPQ_VERSION_STR` basically as alias of `PGSQL_LIBPQ_VERSION`,
and deprecate it right away.

Since we are now requiring at least libpq 9.1, we can remove some
further compatibility code and additional checks.

Regarding the raised requirements: official support for PostGreSQL 9.0
ended on 2015-10-08, and even CentOS 7 already has PostGreSQL 9.2, so
this is not supposed to be too much of an issue.
2020-05-25 10:48:35 +02:00
Christoph M. Becker
4bc1d8333a Raise ext/pgsql requirements to PostGreSQL 7.4
We can safely assume that users have at the very least libpq 7.4, for
which official support ended on 2010-10-01; even CentOS 6 has 8.4 now.
It is also noteworthy that PDO_PGSQL already requires libpq 7.4 or
later.
2020-05-22 15:56:24 +02:00
George Peter Banyard
466e288b01 Fix [-Wundef] warning in PostgreSQL extension 2020-05-20 14:01:11 +02:00
Máté Kocsis
4a816584a4
Make float to string casts locale-independent
From now on, float to string casting will always behave locale-independently.
RFC: https://wiki.php.net/rfc/locale_independent_float_to_string
Closes GH-5224

Co-authored-by: George Peter Banyard <girgias@php.net>
2020-05-08 10:52:23 +02:00
Christoph M. Becker
38ecfe0245 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79532: sizeof off_t can be wrong
2020-04-29 10:43:35 +02:00
Christoph M. Becker
67f9b0b754 Fix #79532: sizeof off_t can be wrong
We have to actually determine the proper `SIZEOF_OFF_T`.
Interestingly, it is `4` on Windows x64.

We also have to prevent the redefinition in pg_config.h.  The clean
solution would likely be to not include pg_config.h at all, but that's
out of scope for BC reasons for now.
2020-04-29 10:40:59 +02:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Nikita Popov
6811222422 Eliminate uses of ZVAL_ZVAL and friends
Instead add RETURN_COPY(_VALUE) macros will the expected behavior.

RETURN_ZVAL doesn't make any sense since PHP 7, but has stuck
around, probably because the alternative was to write directly to
the return_value variable.
2020-01-20 10:34:17 +01:00
Máté Kocsis
d1764ca330
Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
Máté Kocsis
bbcfa66e06
Use RETURN_THROWS() after zend_fetch_resource*() 2020-01-03 19:20:56 +01:00
Máté Kocsis
01a50778d1
Use RETURN_THROWS() after zend_throw_exception() in most of the extensions 2020-01-02 10:56:18 +01:00
Máté Kocsis
345703724c
Use RETURN_THROWS() during ZPP in most of the extensions
Except for some bigger ones: reflection, sodium, spl
2019-12-31 11:46:11 +01:00
Christoph M. Becker
dabc28d182 Fix #78880: Spelling error report
We fix the most often occuring typos according to a recent codespell
report[1] in tests, code comments and documentation.

[1] <https://fossies.org/linux/test/php-src-master-f8f48ce.191129.tar.gz/codespell.html>.
2019-12-21 11:58:00 +01:00
Fabien Villepinte
a555cc0b3d Clean DONE tags from tests
Remove most of the `===DONE===` tags and its variations.
Keep `===DONE===` if the test output otherwise becomes empty.

Closes GH-4872.
2019-11-07 21:31:47 +01:00
Máté Kocsis
9493893412 Cleanup return values when parameter parsing is unsuccessful 2019-10-30 16:05:20 +01:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Nikita Popov
a1e2c8870e Merge branch 'PHP-7.4' 2019-07-22 17:26:01 +02:00
Nikita Popov
d59aac58b3 Report errors from stream read and write operations
The php_stream_read() and php_stream_write() functions now return
an ssize_t value, with negative results indicating failure. Functions
like fread() and fwrite() will return false in that case.

As a special case, EWOULDBLOCK and EAGAIN on non-blocking streams
should not be regarded as error conditions, and be reported as
successful zero-length reads/writes instead. The handling of EINTR
remains unclear and is internally inconsistent (e.g. some code-paths
will automatically retry on EINTR, while some won't).

I'm landing this now to make sure the stream wrapper ops API changes
make it into 7.4 -- however, if the user-facing changes turn out to
be problematic we have the option of clamping negative returns to
zero in php_stream_read() and php_stream_write() to restore the
old behavior in a relatively non-intrusive manner.
2019-07-22 17:17:28 +02:00
Peter Kokot
4ec0889bec Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove HAVE_PQPUTCOPYEND
2019-07-22 16:06:12 +02:00
Peter Kokot
a2b758dab5 Remove HAVE_PQPUTCOPYEND
Symbol is not used anywhere in the code and also Postgresql 7.x is
EOL anyway.

Closes GH-4453
2019-07-22 16:05:26 +02:00
Remi Collet
19d8e054b1 Merge branch 'PHP-7.4'
* PHP-7.4:
  add comment about pg_config/pkgconfig
2019-06-12 09:39:24 +02:00
Remi Collet
66bd7875f8 add comment about pg_config/pkgconfig 2019-06-12 09:39:11 +02:00
Joe Watkins
1e33a8ced4
Merge branch 'PHP-7.4'
* PHP-7.4:
  Revert "ext/pgsql: Use PKG_CHECK_MODULES to detect the pq library"
2019-06-12 08:01:03 +02:00
Joe Watkins
eac238fb6c
Revert "ext/pgsql: Use PKG_CHECK_MODULES to detect the pq library"
This reverts commit 1e265174ed.
2019-06-12 08:00:55 +02:00
Joe Watkins
d8f712c302
Merge branch 'PHP-7.4'
* PHP-7.4:
  ext/pgsql: Use PKG_CHECK_MODULES to detect the pq library
2019-06-11 08:54:00 +02:00
Hugh McMaster
1e265174ed
ext/pgsql: Use PKG_CHECK_MODULES to detect the pq library 2019-06-11 08:53:49 +02:00
Dmitry Stogov
e029cc4dd4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Cheaper checks for exceptions thrown from __toString()
2019-06-06 02:23:17 +03:00
Dmitry Stogov
457392fa64 Cheaper checks for exceptions thrown from __toString() 2019-06-06 01:47:22 +03:00
Nikita Popov
7686b0b889 Merge branch 'PHP-7.4' 2019-06-05 14:53:50 +02:00
Nikita Popov
a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Nikita Popov
b1bdae7621 Merge branch 'PHP-7.4' 2019-06-04 12:25:16 +02:00
Nikita Popov
3f7210efa8 Try to make 17result.php more robust
This is our most common intermittent failure. I don't understand
why it happens and can't reproduce it, but defining an explicit
sort order seems worth a shot...
2019-06-04 12:18:21 +02:00
Nikita Popov
1df8175b61 Convert fetch_resource warnings into TypeErrors
More type checks that are not part of zpp and should generate a
TypeError in PHP 8.
2019-06-03 09:17:12 +02:00