Commit Graph

1062 Commits

Author SHA1 Message Date
Christoph M. Becker
50b3a0d011
Add comments about internal headers (GH-15689)
A common convention is to name internal C header files as `*_int.h`.
Since a couple of these are actually installed, we add comments that
this is not supposed to happen, (a) to avoid installing further
internal headers, and (b) to pave the way to fix this in the next major
PHP version.

Somewhat special is php_gmp_int.h, where "int" is meant as abbreviation
for "interface".

Another common convention is appending `_priv` or `_private`, but since
there have not been any issues regarding these headers so far, we
refrain from adding respective comments to these headers.

Anyhow, it might be a good idea to introduce some common naming
convention for such internal/private headers.
2024-09-08 16:11:25 +02:00
Christoph M. Becker
a57ce052cd
Don't export php_pdo_int.h
This is, as the name and a comment in the header imply, an internal
header which is not supposed to be used by extensions other than PDO
(not even by drivers).

Since there is apparently no need to include this header in the parsers
of the drivers, we remove these includes, and no longer declare the
header to be installed.  Given that the header is only exported for a
couple of weeks[1], this is not considered to be a BC break, because
it's unlikely that external drivers have already been adjusted to use
this header, and otherwise they can still be fixed; PHP 8.4 is still in
the pre-release stage.

[1] <https://github.com/php/php-src/pull/14797>

Closes GH-15688.
2024-09-01 13:33:53 +02:00
Peter Kokot
5ed1659039
Autotools: Fix pdo_mysql build with mysql client library (#15450)
When using --with-pdo-mysql=DIR and for some reason DIR wouldn't have
the executable DIR/bin/mysql_config available the 3rd option was so far
to guess the mysql client library locations and pass the include
directory further. The library directory and library name to link was
missing. This fixes this case for consistency reasons. And in the future
also the pkg-config could be a reliable alternative to mysql_config in
that case. The PDO_MYSQL_INC_DIR is already processed PHP_EVAL_INCLINE
so redundant PHP_ADD_INCLUDE is removed.
2024-08-31 02:35:34 +02:00
Máté Kocsis
8d12f666ae
Fix registration of internal readonly child classes (#15459)
Currently, internal classes are registered with the following code:

INIT_CLASS_ENTRY(ce, "InternalClass", class_InternalClass_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ...;

This has worked well so far, except if InternalClass is readonly. It is because some inheritance checks are run by zend_register_internal_class_ex before ZEND_ACC_READONLY_CLASS is added to ce_flags.

The issue is fixed by adding a zend_register_internal_class_with_flags() zend API function that stubs can use from now on. This function makes sure to add the flags before running any checks. Since the new API is not available in lower PHP versions, gen_stub.php has to keep support for the existing API for PHP 8.3 and below.
2024-08-24 12:36:54 +02:00
Gina Peter Bnayard
5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Peter Kokot
693ec809b9
Autotools: Remove PDO dependency related errors (#15347)
Follow-up of GH-15344 (687eb9125a)

This removes the customized error messages in PDO extensions when PDO is
not enabled (--disable-all or --disable-pdo) in favor of the default
error done by PHP_ADD_EXTENSION_DEP.
2024-08-11 21:35:36 +02:00
Peter Kokot
a5f8cbd93d
Autotools: Refactor mysql_config checks in pdo_mysql (#15336)
- Scattered if blocks moved together as PDO_MYSQL_UNIX_ADDR is defined
  only when mysql_config is available
- Obsolete backticks command substitutions `...` replaced with the
  recommended $(...)
2024-08-11 12:18:27 +02:00
Peter Kokot
e5f6387569
Autotools: Refactor pdo_mysql checks (#15334)
- Main checks wrapped in AS_CASE
- s/UNIX/Unix
- Redundant MYSQL_SOCK variable removed
2024-08-10 21:52:38 +02:00
Peter Kokot
8044db121f
Update mysql preprocessor macros help texts (#15288)
This adds missing help texts for preprocessor macros defined in
mysqli and pdo_mysql extensions.

[skip ci]
2024-08-09 18:07:05 +02:00
Peter Kokot
d6a75e19d1
Sync preprocessor macros help texts (#15218)
This partially syncs help texts a bit further for:
- ext/ffi
- ext/ldap
- ext/opcache
- ext/pcre
- ext/pdo_mysql
- ext/readline
- ext/standard
2024-08-04 12:52:16 +02:00
Peter Kokot
1ceadaed52
Autotools: Normalize and quote all PHP_NEW_EXTENSION arguments (#15144)
This adds Autoconf quote characters to all PHP_NEW_EXTENSION arguments
and syncs the CS across the php-src Autotools build system.
2024-07-29 00:14:59 +02:00
Peter Kokot
97afc86437
Autotools: Quote M4 arguments (#15045)
- AC_MSG_CHECKING
- AC_MSG_RESULT
- AC_MSG_WARN
- AC_MSG_ERROR
- AC_MSG_NOTICE
2024-07-21 01:52:17 +02:00
Peter Kokot
68ae477796
Autotools: Quote M4 arguments (#15033)
- PHP_ADD_INCLUDE
- PHP_EVAL_INCLINE
- PHP_EVAL_LIBLINE
2024-07-20 07:21:44 +02:00
Saki Takamachi
acd6ac3324
Fixed parent class of stub (#14990) 2024-07-17 21:38:59 +09:00
Peter Kokot
bee84c0468
Autotools: Quote PHP_SUBST arguments in extensions (#14748) 2024-07-02 06:56:18 +02:00
Arnaud Le Blanc
11accb5cdf
Preferably include from build dir (#13516)
* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

    -I$(top_builddir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/main
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM
    -I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

    -I$(top_builddir)/main
    -I$(top_builddir)
    -I$(top_srcdir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
2024-06-26 00:26:43 +02:00
Peter Kokot
f3feef8b93
Define default RE2C_FLAGS (#14615)
The --no-generation-date flag is a common re2c flag used in all re2c
invocations. This adds the 2nd optional argument to PHP_PROG_RE2C M4
macro in BC manner to set the default re2c command-line options and sets
the default RE2C_FLAGS similarly on Windows.
2024-06-24 22:09:04 +02:00
Peter Kokot
8d876e435b
Enable static tsrmls cache in pdo_mysql with mysqlnd (#14634)
The tsrmls cache has been integrated in
aac7b1db7c but not enabled when pdo_mysql
is built for mysqlnd extension.
2024-06-23 21:12:35 +02:00
Peter Kokot
0ed134100f
Update mysqli and pdo_mysql extension dependencies (#14633)
- The mysqlnd is required dependency in mysqli extension
- When building pdo_mysql with mysqlnd (--with-pdo-mysql or
  --with-pdo-mysql=mysqlnd) mysqlnd is required
- This also adds missing configure time pdo dependency to pdo_mysql
2024-06-23 19:59:31 +02:00
Matteo Beccati
5a3c4a2c9c
Fix test when using libmysqlclient
TL;DR
When suing libmysqlclient, ints are fetched as strings, so the strict comparison was failing
2024-06-20 13:25:52 +02:00
Matteo Beccati
037243ccd7
pdo_mysql: "--" should be followed by a whitespace character
This required changing how YYFILL works, with no apparent regressions
2024-06-17 23:31:25 +02:00
Matteo Beccati
715b9aaa09
Implemented PDO Driver specific SQL parsers
RFC: http://wiki.php.net/rfc/pdo_driver_specific_parsers
2024-06-17 23:31:24 +02:00
Peter Kokot
df481ef941
Simplify PDO include paths (#14444)
PDO include paths can be simplified and synced as done in other
extensions: either the project root directory or the phpincludedir (for
the system installation). The 'ext' include is automatically appended
when doing phpize build. In php-src it is only present on Windows build.
The PHP_CHECK_PDO_INCLUDES is left intact working as before and checks
if PDO headers are found.
2024-06-03 12:56:21 +02:00
Máté Kocsis
6ec4220148
Amend PDO driver-specific class names (#14069)
As suggested in https://externals.io/message/123166
2024-05-30 20:15:42 +02:00
Gina Peter Banyard
07a48517ac
Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/readline: Fix [-Wcalloc-transposed-args] compiler warning
  ext/pdo_mysql: Fix [-Wcalloc-transposed-args] compiler warning
  ext/gd: Fix [-Wcalloc-transposed-args] compiler warning
  ext/ffi: Fix [-Wenum-int-mismatch] compiler warning
  ext/bcmath: Fix [-Wenum-int-mismatch] compiler warning
2024-05-21 12:23:45 +01:00
Gina Peter Banyard
b2c0db1f89
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  ext/readline: Fix [-Wcalloc-transposed-args] compiler warning
  ext/pdo_mysql: Fix [-Wcalloc-transposed-args] compiler warning
  ext/gd: Fix [-Wcalloc-transposed-args] compiler warning
  ext/ffi: Fix [-Wenum-int-mismatch] compiler warning
  ext/bcmath: Fix [-Wenum-int-mismatch] compiler warning
2024-05-21 12:21:46 +01:00
Gina Peter Banyard
d4accd8b12
ext/pdo_mysql: Fix [-Wcalloc-transposed-args] compiler warning 2024-05-21 12:17:25 +01:00
Peter Kokot
e1181a64d4
Remove HAVE_MYSQL (#13719)
The ext/pdo_mysql symbol has been once used together with the removed
ext/mysql extension and isn't defined on Windows neither used in the
code anymore.
2024-03-15 20:33:59 +01:00
Saki Takamachi
3dc9503a96
Revert "Fixed GH-13167 Fixed the behavior of bindValue and bindParam. (#13384)"
This reverts commit 68f10504de.
2024-03-09 10:34:32 +09:00
Saki Takamachi
00bee30132
Revert "Tidy up UT and add NEWS entry"
This reverts commit 1d45357409.
2024-03-09 10:34:17 +09:00
Niels Dossche
37989666ef Avoid copying escaped string, truncate instead 2024-03-07 20:27:18 +01:00
Saki Takamachi
a31edaa99b
Merge branch 'PHP-8.3'
* PHP-8.3:
    Removed `REPORT_EXIT_STATUS=no` in libmysql tests
2024-02-29 08:49:53 +09:00
Saki Takamachi
116166cd30
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Removed `REPORT_EXIT_STATUS=no` in libmysql tests
2024-02-29 08:49:04 +09:00
Saki Takamachi
99688dbe7a
Removed REPORT_EXIT_STATUS=no in libmysql tests 2024-02-29 08:41:36 +09:00
Peter Kokot
7b7f97b518 Remove duplicate Autoconf check for sed
The sed program is always available since it is already discovered in
configure.ac and phpize.m4.
2024-02-26 11:47:59 +01:00
Niels Dossche
25dbe5374a Add test with quoting multibyte GBK vs utf8mb4 in PDO 2024-02-23 23:52:24 +01:00
Kamil Tekiela
50598a7097
Tidy up pdo_mysql_attr_max_buffer_size.phpt 2024-02-18 13:09:19 +01:00
Saki Takamachi
d433035319
Fixed tests for libmysql (#13424) 2024-02-18 13:08:31 +01:00
Kamil Tekiela
1d45357409
Tidy up UT and add NEWS entry 2024-02-18 12:47:30 +01:00
Saki Takamachi
68f10504de
Fixed GH-13167 Fixed the behavior of bindValue and bindParam. (#13384)
Fixed to generate an error when a non-scalar value is passed in
`PDO_PARAM_EVT_EXEC_PRE` of `pdo_mysql_stmt_param_hook` unless
it is a `Stringable` object.
2024-02-18 12:10:21 +01:00
Máté Kocsis
10957e498c
Do not generate frameless info items when func info generation is disabled
While here, I fixed newlines around arginfo and function entry generation. Previously, newlines were repeated.
2024-02-18 11:39:00 +01:00
Kamil Tekiela
a96cc80be2
Fix PDO unit test description 2024-01-22 17:29:17 +01:00
Máté Kocsis
9c7b3914e7
DeclarePdoMysql:: ATTR_SSL_VERIFY_SERVER_CERT only for Mysqlnd 2024-01-14 16:29:13 +01:00
Máté Kocsis
d6a0b3af68
Implement PDO driver-specific subclasses
RFC: https://wiki.php.net/rfc/pdo_driver_specific_subclasses
Closes GH-12804

Co-Authored-By: Danack <Danack@basereality.com>
2024-01-11 23:22:41 +01:00
Niels Dossche
c3f6579f93 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12969: Fixed PDO::getAttribute() to get PDO::ATTR_STRINGIFY_FETCHES
2023-12-22 15:07:10 +01:00
SakiTakamachi
b333164423 Fix GH-12969: Fixed PDO::getAttribute() to get PDO::ATTR_STRINGIFY_FETCHES
Partial backport of GH-12793.

Closes GH-12970.
2023-12-22 15:06:01 +01:00
Saki Takamachi
866aa12bcd
ext/pdo: Fixed PDO::setAttribute() and PDO::getAttribute() (#12793) 2023-12-04 16:05:30 +00:00
Saki Takamachi
4bb75d569e
ext/pdo_mysql: Optimize tests (#12751) 2023-11-27 13:01:24 +00:00
Peter Kokot
de85e4a6d3
Remove unused PDO_MYSQL_MODULE_TYPE variable (#12711) 2023-11-18 04:18:15 +00:00
Alexandre Daubois
6f95273941
ext/pdo_mysql: Improve tests cleanup (#11879)
This allows the tests to be run in parallel.
2023-11-16 18:49:43 +00:00