Commit Graph

262 Commits

Author SHA1 Message Date
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
5fc68d8bab
Update preprocessor macros help texts for enchant and snmp extensions (#15255)
[skip ci]
2024-08-06 23:22:28 +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
0970fd439a
Autotools: Sync CS in enchant extension 2024-07-30 07:54:32 +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
2b97c84d4c
Autotools: Quote PHP_CHECK_LIBRARY arguments (#15136)
This syncs the quotes across the PHP_CHECK_LIBRARY macro arguments.
2024-07-28 18:39:14 +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
Tim Düsterhus
29f98e7485
Replace @deprecated by #[\Deprecated] for internal functions / class constants (#14750)
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-07-10 16:47:31 +02: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
9f63836cf4
Remove redundant _WIN32 compile definitions (#14458)
_WIN32 is defined by all compilers on Windows when targeting 32-bit ARM,
64-bit ARM, x86, or x64. This removes redundant definition in ext/zip
and erroneous CFLAG_ENCHANT variable (should be CFLAGS_ENCHANT).
2024-06-07 22:59:30 +02:00
Peter Kokot
329f015c91
Sync HAVE_ENCHANT_BROKER_SET_PARAM definitions (#14340)
This defines the HAVE_ENCHANT_BROKER_SET_PARAM to 1 or doesn't define it
so it can be used in a similar way between platforms. It is only defined
for Enchant versions 1.5.0 to 2.x. Previously on Windows it was defined
to 0 if not found.
2024-05-27 21:59:44 +02:00
Peter Kokot
4f311f86cc
Remove redundant ext/spl/spl_exceptions.h include (#14337) 2024-05-27 15:40:07 +02:00
guangwu
f1a22d0943
fix: typos (#13694)
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
2024-03-13 09:30:33 +01: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
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
Ilija Tovilo
50f58c8923
Add ASAN XLEAK support
Only disable LSAN instead of skipping the test. This way we can still detect
memory issues which is arguably more important anyway.

Closes GH-10996
2023-04-03 08:02:19 +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
Pierrick Charron
6fd2b39397
Indent with TAB in .h files generated by gen_stub 2022-06-13 08:55:54 -04:00
Máté Kocsis
debd38f851 Add support for sensitive parameters in stubs 2022-06-04 18:15:05 +02:00
Máté Kocsis
8d79e665f1
Declare ext/enchant constants in stubs (#8679) 2022-06-01 20:15:10 +02:00
Máté Kocsis
d02b9b953d
Add more specific array return type hints for various extensions - part 1
ext/bz2, ext/calendar, ext/dba, ext/enchant

Closes GH-7432
2021-11-07 08:46:25 +01:00
Joe Watkins
570d9b63e9
Not serializable flag permeation 2021-07-20 12:28:35 +02:00
Nikita Popov
7485978339
Migrate SKIPIF -> EXTENSIONS (#7138)
This is an automated migration of most SKIPIF extension_loaded checks.
2021-06-11 11:57:42 +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
ce0bc58c22 Merge branch 'PHP-8.0'
* PHP-8.0:
  Mark resource-like objects as non-comparable
2021-02-16 14:22:03 +01:00
Nikita Popov
b63ea1047a Mark resource-like objects as non-comparable
As these hold on to some internal resource, there can't be two
"equal" objects with different identity. Make sure the lack of
public properties doesn't result in these being treated as always
equal.
2021-02-16 14:20:45 +01:00
Máté Kocsis
bf0f6aaf18
Improve class entry generation
Related to GH-6701
2021-02-16 13:09:56 +01:00
Máté Kocsis
99b08ac281
Implicitly enable function entry generation when class entry generation is enabled
Closes GH-6675
2021-02-09 13:37:24 +01:00
Máté Kocsis
98fb565c74
Generate class entries from stubs for another batch of extensions
Closes GH-6669
2021-02-08 19:53:55 +01:00
Máté Kocsis
811f6dd8e5
Review parameter names in ext/enchant
Closes GH-6258
2020-10-02 11:55:46 +02:00
Nikita Popov
c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Máté Kocsis
1fb66b8114
Promote warning to exception in ext/enchant
Closes GH-6022
2020-08-24 17:37:20 +02:00
George Peter Banyard
9a71d47d73 Throw ValueError on empty tag in enchant_broker_request_dict() 2020-07-31 14:35:14 +01:00
Máté Kocsis
0d330e1a02
Add a few missing parameter types in stubs
Related to GH-5627
2020-07-30 14:26:45 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Nikita Popov
9b41f22fb2 Remove leftover debug comment 2020-07-02 11:51:51 +02:00
Nikita Popov
4500309f10 Skip enchant test under asan
There is a known memory leak here:
https://bugs.launchpad.net/ubuntu/+source/enchant/+bug/305468
2020-07-02 11:37:09 +02:00
Fabien Villepinte
0c6d06ecfa Replace EXPECTF when possible
Closes GH-5779
2020-06-29 21:31:44 +02:00
Nikita Popov
653e4ea1c5 Add flag to forbid dynamic property creation on internal classes
While performing resource -> object migrations, we're adding
defensive classes that are final, non-serializable and non-clonable
(unless they are, of course). This path adds a ZEND_ACC_NO_DYNAMIC_PROPERTIES
flag, that also forbids the creation of dynamic properties on these objects.
This is a subset of #3931 and targeted at internal usage only
(though may be extended to userland at some point in the future).

It's already possible to achieve this (what the removed
WeakRef/WeakMap code does), but there's some caveats: First, this
simple approach is only possible if the class has no declared
properties, otherwise it's necessary to special-case those
properties. Second, it's easy to make it overly strict, e.g. by
forbidding isset($obj->prop) as well. And finally, it requires a
lot of boilerplate code for each class.

Closes GH-5572.
2020-06-24 11:52:36 +02:00
Nikita Popov
c9b9f525a9 Include stub hash in generated arginfo files
The hash is used to check whether the arginfo file needs to be
regenerated. PHP-Parser will only be downloaded if this is actually
necessary.

This ensures that release artifacts will never try to regenerate
stubs and thus fetch PHP-Parser, as long as you do not modify any
files.

Closes GH-5739.
2020-06-24 09:55:19 +02:00
Máté Kocsis
ba434fb5a6
Remove outdated PHPDoc from ext/enchant's stub 2020-06-23 22:35:27 +02:00
Nikita Popov
607567b9cd Call zpp in enchant_broker_*_dict_path with libenchant-2
Even if the function is a dummy, we still need to call zpp to
comply with arginfo.
2020-06-18 17:10:22 +02:00
Máté Kocsis
cd3e04dff3
Convert enchant resources to opaque objects
Additionally, deprecate ENCHANT_MYSPELL and ENCHANT_ISPELL constants.
Closes GH-5577

Co-authored-by: Remi Collet <remi@php.net>
2020-05-29 14:51:41 +02:00
Nikita Popov
a01b6e5787 Return empty array instead of null from enchant APIs
Closes GH-5566.
2020-05-27 10:12:21 +02:00
Remi Collet
5318971bc5 Revert "convert enchant resources to objects of new classes - EnchantBroker - EnchantDict add OO interface deprecate enchant_broker_free* (use unset instead) deprecate ENCHANT_MYSPELL and ENCHANT_ISPELL constants"
This reverts commit 7db4c24a37.
2020-05-13 15:56:14 +02:00