Commit Graph

788 Commits

Author SHA1 Message Date
DanielEScherzer
5dd0575698
Generated arginfo header files: combine preprocessor conditional blocks (#15736)
When functions' or class methods' availability is based on some preprocessor
condition, the generated arginfo header files wrap the declarations in the
preprocessor `#if` conditional blocks, one per declaration, even if they are in
the same conditional block based on comments in the stub file. Instead of
having multiple conditional blocks one after the other with the same condition,
combine them into a single conditional block.
2024-09-04 13:04:22 +02:00
DanielEScherzer
53cb89670c
Generated arginfo header files: remove empty zend_function_entry arrays (#15705)
When a class (or enum) has no methods, rather than using an array that only
contains `ZEND_FE_END`, use `NULL` for the functions. The implementation of
class registration for internal classes, `do_register_internal_class()` in
zend_API.c, already skips classes where the functions are `NULL`. By removing
these unneeded arrays, we can reduce the size of the header files, while also
removing an unneeded call to zend_register_functions() for each internal class
with no extra methods.
2024-09-03 23:19:53 +02:00
Peter Kokot
1b757c8d3c
Autotools: Replace backticks command substitutions with $(...) (#15639)
This is a follow-up of previous backticks replacement commits. This
replaces backticks command substitutions in remaining ext config M4
files, phpize, and configure.ac with the recommended $(...).

Note that $(...) still does not work on some obsolete shells that ship
with Solaris 10, for example. Elsewhere they should work. However, for
these obsolete shells Autoconf also re-executes the shell script under
the supported shell so it can make them work regardless.

Additionally, few comments CS are also adjusted to not cause confusion
when searching for backticks usages and one indentation sync done.

As of Autoconf 2.72 the backticks in macro help texts are also replaced
with single quotes.
2024-08-30 00:40:49 +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
Gina Peter Bnayard
e7c4d54d65 Use new helper function for "cannot be empty" ValueErrors 2024-08-21 21:12:17 +01:00
Peter Kokot
bb35da336d
Autotools: Sync CS in extensions (#15343)
- Redundant double quotes removed
- AS_* macros used
- Few nits adjusted here and there
2024-08-11 17:42:26 +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
dcdcb3cbfe
Autotools: Replace AC_MSG_ERROR with AC_MSG_FAILURE (#15209)
This replaces the AC_MSG_ERROR with AC_MSG_FAILURE, where appropriate.

The AC_MSG_ERROR outputs given message and exits the configure step. The
AC_MSG_FAILURE does the same but also automatically outputs additional
message "See 'config.log' for more details." which might help directing
the user where to look further.

The AC_MSG_ERROR is used for errors where current test step isn't logged
in the config.log and wouldn't make sense, and AC_MSG_FAILURE is mostly
used in cases of library checks, compilation tests, headers checked with
AC_CHECK_HEADER* and similar tests that are also logged in the
config.log.

AC_MSG_ERROR([Sanity check failed.]) output:

```
configure: error: Sanity check failed.
```

AC_MSG_FAILURE([Sanity check failed.]) output:

```
configure: error: in '/path/to/php-src':
configure: error: Sanity check failed.
See 'config.log' for more details
```
2024-08-04 07:36:37 +02:00
Peter Kokot
f66feaec0f
Sync HAVE_<extension> help texts (#15167)
This syncs all help texts of extension preprocessor macros to the same
style "Define to 1 if the PHP extension '<ext>' is available.".
[skip ci]
2024-08-02 01:41:47 +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
ff4b99e260
Autotools: Quote PHP_ADD_LIB* arguments (#15112)
Following previous CS syncs, this quotes arguments in PHP_ADD_LIB* M4
macros:
- PHP_ADD_LIBRARY
- PHP_ADD_LIBRARY_WITH_PATH
- PHP_ADD_LIBPATH
2024-07-26 23:26:55 +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
Christoph M. Becker
f590b34530
Drop support for OpenSSL < 1.1.0 on Windows
PR #13498 bumped the required OpenSSL version to 1.1.1, but apparently
only for non Windows system.  We catch up somewhat by dropping support
for OpenSSL < 1.1.0 on Windows; besides completely removing detection
of old OpenSSL versions in `SETUP_OPENSSL`, we also ensure that all
bundled extension using this function do no longer accept OpenSSL <
1.1.0, to avoid to still be able to build these extensions with older
`phpize` scripts.

We do not cater to `--phar-native-ssl` yet; that might better be
addressed by #14578.

Closes GH-14973.
2024-07-17 12:22:59 +02:00
Peter Kokot
d7cd155e8d
Autotools: Refactor cache variables in configure.ac and ext/ldap (#14784)
- Cache variables ac_cv_ renamed on few places to php_cv_
- Over-quoted arguments reduced
- AS_VAR_IF and CS synced
2024-07-03 21:57:51 +02:00
Peter Kokot
bee84c0468
Autotools: Quote PHP_SUBST arguments in extensions (#14748) 2024-07-02 06:56:18 +02:00
Peter Kokot
2041c133ac
Normalize AC_CHECK_FUNC* first argument (#14700)
The m4_normalize is for Autoconf < 2.70 (on 2.70 and later versions a
blank-or-newline separated items can be expanded without using
backslash-newline).

This also syncs the 1st argument quotes.
2024-06-28 22:40:24 +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
271f91169e
Remove WINDOWS symbol from ext/ldap/ldap.c (#14468)
The WINDOWS symbol was used up to commit
f79688e848 where it got undefined when
condition `#if WIN32|WINNT` was met. Then the condition was replaced
with simpler PHP_WIN32 (which today implies also 64-bit platforms) and
WINDOWS is undefined in this file when targeting Windows platform.
Conditions otherwise also work on Windows anyway because of the
LDAP_API_VERSION check.
2024-06-07 23:27:22 +02:00
haszi
9864d91ea6
Fix typo in LDAP stub (#14313)
Co-authored-by: haszi <haszika80@gmail.com>
2024-05-25 13:31:54 +02:00
Máté Kocsis
3876225763
Fix casing of NULL default values 2024-04-27 23:45:55 +02:00
Peter Kokot
a6fdd8fb19
Update ext/ldap sanity check (#13946)
The ldap_bind_s() has been deprecated and isn't used in the code in
favor of ldap_sasl_bind_s(). PHP falls back to deprecated
ldap_simple_bind_s() if for some reason ldap_sasl_bind_s() isn't
available and this check likewise.
2024-04-12 10:20:26 +02:00
Máté Kocsis
f2e199e878
Implement "support doc comments for internal classes and functions" (#13266)
Fixes #13130
2024-02-25 08:41:31 +01:00
Ilija Tovilo
fd47cd8b69
[skip ci] Fix ldap skipif 2024-02-19 10:16:13 +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
David CARLIER
09415077f9
ext/ldap: few new unit tests (tls13 protocol). (#13409) 2024-02-16 18:26:08 +00:00
Steve Wall
f6016c702f ext/ldap: Add LDAP_OPT_X_TLS_PROTOCOL_MAX and LDAP_OPT_X_TLS_PROTOCOL_TLS1_3
close GH-13405.
2024-02-15 21:43:46 +00:00
Máté Kocsis
682c2366be Deprecate calling ldap_exop() with more than 4 arguments 2023-12-04 22:27:59 +01:00
Máté Kocsis
1d41eb3014 Deprecate calling ldap_connect() with more than 2 arguments 2023-12-04 22:27:59 +01:00
Ilija Tovilo
f39b5c4c25
Close PHP tags in tests
Closes GH-12422
2023-10-18 17:34:10 +02:00
Máté Kocsis
b3bd55f244 Implement ldap_exop_sync 2023-07-18 12:59:21 +02:00
Máté Kocsis
72aada3c7c Implement ldap_connect_wallet() 2023-07-18 12:59:21 +02:00
Andreas Heigl
69a8b63ecf
Deprecate ldap_connect with two parameters (#5177)
* Deprecate ldap_connect with two parameters

ldap_connect should be called with an LDAP-URI as parameter and not with
2 parameters as that allows much more flexibility like differentiating
between ldap and ldaps or setting multiple ldap-servers.

This change requires one to add null as second parameter in case the
underlying library is Oracle and one wants to add wallet-details.

* Modify all ldap-tests to use ldap_connect right

All tests are using ldap_connect now with an URI and not with host and
port as two separarte parameters.

* Verify deprecation of ldap_connect w/h 2 params

This adds a test to verify that calling ldap_connect with 2 parameters
triggers a deprecation notice

* Remove empty test

`ldap_control_paged_result()` is removed as of PHP 8.0.0, so this test
needs to be removed as well.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2023-07-10 10:44:01 +01:00
George Peter Banyard
d5ad75108e
More usage of known zend_str instead of C string (#11381) 2023-06-08 13:03:29 +01:00
Máté Kocsis
7936c8085e
Fix GH-8329 Print true/false instead of bool in error and debug messages (#8385) 2023-01-23 10:52:14 +01:00
Christoph M. Becker
cea0fc04d1
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-10112: LDAP\Connection::__construct() refers to ldap_create()
2022-12-16 14:38:09 +01:00
Christoph M. Becker
018fbd0a68
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10112: LDAP\Connection::__construct() refers to ldap_create()
2022-12-16 14:37:39 +01:00
Christoph M. Becker
b8ac2071b8
Fix GH-10112: LDAP\Connection::__construct() refers to ldap_create()
There is no `ldap_create()`, but rather `ldap_connect()`.

Closes GH-10115.
2022-12-16 14:36:30 +01:00
Bob Weinand
a01dd9feda Revert "Port all internally used classes to use default_object_handlers"
This reverts commit 94ee4f9834.

The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
Máté Kocsis
e733ebf30e
Add parenthesis around preprocessor conditions in stubs
gen_stub.php concatenates nested #ifs into one #if so let's make sure the semantics remain the same.
2022-09-02 16:21:28 +02:00
Bob Weinand
94ee4f9834 Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00
Máté Kocsis
b4ec3e9bc0
Do not generate CONST_CS when registering constants (#9439) 2022-08-28 08:27:19 +02:00
Máté Kocsis
e328c68305
Rename @cname to @cvalue in stubs (#9043)
@cname currently refers to the constant name in C. However, it is not always a (constant) name, but sometimes a function invocation, so naming it as @cvalue would be more appropriate.
2022-07-19 15:11:42 +02:00
Remi Collet
55a88f36b6
add SensitiveParameter as known string and use it in arginfo 2022-07-18 11:43:33 +02:00
Tim Düsterhus
342e18f105
Support the actual #[\SensitiveParameter] attribute in stubs (#8836) 2022-07-12 12:43:44 +02:00
Pierrick Charron
6fd2b39397
Indent with TAB in .h files generated by gen_stub 2022-06-13 08:55:54 -04:00
Tim Düsterhus
788b7a0c6c Mark parameter in ext/ldap as sensitive 2022-06-13 11:09:12 +02:00
Máté Kocsis
e7c30c059c
Declare ext/ldap constants in stubs (#8717) 2022-06-06 21:30:10 +02:00
Nikita Popov
605ac4649c Merge branch 'PHP-8.1'
* PHP-8.1:
  Use ASCII lower case for misc case folding
2021-09-24 09:23:18 +02:00