Commit graph

481 commits

Author SHA1 Message Date
Tim Düsterhus
6ca6d569ff
bless_tests: Replace the object ID in var_dump() for namespaced classes (#19174) 2025-07-18 20:43:23 +02:00
Tim Düsterhus
39cf27689b
php_gdb: Print some numeric fields as hexadecimal (#18925)
* php_gdb: Print `zend_string*`’s `h` field as hexadecimal

A decimal representation of a hash value is not particularly meaningful and
makes it harder to compare hash values.

* php_gdb: Print `HashTable*`’s `nTableMask` field as hexadecimal
2025-06-24 15:22:25 +02:00
NickSdot
01abca9852
[skip ci ] fix: deleted stray semicolon (GH-18782) 2025-06-06 14:25:19 +02:00
Máté Kocsis
d585a5609d
Add ext/uri skeleton along with uriparser (#18658)
Relates to https://github.com/php/php-src/pull/14461/ and https://wiki.php.net/rfc/url_parsing_api
2025-05-27 08:16:24 +02:00
Máté Kocsis
7f59fccd52
Create separate lexbor extension (#18538)
An always enabled lexbor extension is added, containing the lexbor library that was separated from ext/dom extension in preparation of https://wiki.php.net/rfc/url_parsing_api. While at it, the lexbor library is upgraded to 2.5.0.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Co-authored-by: Gina Peter Banyard <girgias@php.net>
2025-05-25 14:12:44 +02:00
Luis Carilla Ternero
02d58faad4
GDB: replace match statements with if statements in gdb debug script so it works with lower versions (#18226) 2025-04-02 11:56:16 +02:00
Arnaud Le Blanc
a519a03f63
Merge branch 'PHP-8.4'
* PHP-8.4:
  GDB: Import gdb.printing
2025-03-27 16:35:17 +01:00
Arnaud Le Blanc
9b96ea1a99
GDB: Import gdb.printing
gdb.printing is not imported by default since version 16, for some reason
2025-03-27 16:31:28 +01:00
Tim Düsterhus
9466b3fbda
php_gdb: Add support for ZEND_AST_CALLABLE_CONVERT to ZendAstPrettyPrinter 2025-02-25 09:25:54 +01:00
DanielEScherzer
0b42749621
GDB: apply ast pretty printing to specialized structures (#17884)
The `ZendAstPrettyPrinter` had logic to handle the various structures that are
based on `zend_ast`, like `zend_ast_decl`, but the printer was only installed
when the value was a `zend_ast`, meaning that for the specialized structures
the details wouldn't be shown unless they were cast (in GDB) to `zend_ast`.
Instead, just register the printer for the specialized structures too.
2025-02-25 09:17:14 +01:00
Tim Düsterhus
55994f83e0
php_gdb: Fix missing casts in ZendAstPrettyPrinter (#17786)
Fixes php/php-src#17782
2025-02-13 17:19:47 +01:00
Arnaud Le Blanc
9df1c930bf
GDB script improvements (#17227)
* Support IS_INDIRECT, IS_PTR, IS_ALIAS_PTR when printing zvals
* Pretty print the ce_flags field when pretty printing a zend_class_entry
* Pretty print the const flags when pretty printing a zend_class_constant
* Added a minimal zend_property_info pretty printer to pretty print the flags field
* Added minimal zend_function, zend_op_array, and zend_internal_function pretty printers: The string value is the function/method name, function type (user/internal), and location (when possible). The fn_flags field is pretty printed
* Added a minimal zend_op pretty printer to pretty print the opcode
* Added a zend_refcounted_h pretty printer to pretty print the type_info
* Added minimal pretty printers for zend_object and zend_array
* Print the type and address of pretty-printed structs
* Added gdb commands: print_fn_flags, print_ce_flags, print_prop_flags, print_const_flags, print_ref_type_info, print_opcode, dump_op_array
* Fields of type zend_string, zend_class_entry, zend_array are printed by default in all our pretty printers, using short representation
* Increased the maximum length of printed strings to 200 chars before truncation (was 50)
2025-01-30 12:22:07 +01:00
Tim Düsterhus
cee64ed3bd
Add dedicated zend_ast_op_array struct (#17391)
Given that the `ZEND_AST_OP_ARRAY` type already needed special handling in
various places, it makes sense to give it its own struct to avoid some of the
casts. As a side benefit, it is a little smaller than the `zend_ast_zval`
struct.
2025-01-08 11:26:35 +01:00
Christoph M. Becker
f603d9c703
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fail early in *nix configuration build script
2024-11-09 14:07:12 +01:00
Christoph M. Becker
257387b9e5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fail early in *nix configuration build script
2024-11-09 14:06:35 +01:00
Hans Krentel (hakre)
c075546320
Fail early in *nix configuration build script
Adding two exit early safeguards in the *nix configuration build script:

1) Given the initial cd into the build tree fails (the project root),
   the `buildconf` script exits with non-zero status (failure).
2) Given the grep command does not exist or `configure.ac` AC_INIT [1]
   expectations are unmet, the buildconf script exits non-zero.

Additionally quoting the pathname to cd into and the empty CD_PATH
parameter for portability, also for systems that are using a
non-portable pathname [2] for the build tree.

The initial CD safeguard has been applied to the `buildconf` and
four more scripts:

- build/genif.sh
- scripts/dev/credits
- scripts/dev/genfiles
- scripts/dev/makedist

Rationale:

Cd-ing into the project root should always prematurely exit w/ FAILURE
as a required precondition for its invocation has not been met. This
should never go unnoticed as it always requires user intervention.

Similar and more specifically to the PHP build on *nix systems, the
grep command is required early to obtain the `php_extra_version` from
configure.ac.  Previously, if the grep command is missing (or failing
due to not matching the line with the AC_INIT macro [1]), the internal
dev parameter would always be zero (0) which can easily result in the
situation that the configure script is not being rebuilt. This is
cumbersome as the rebuild of a configure script is more likely required
with checked-out dev versions under change rather than an already
properly set-up build environment on a dedicated build or release
system. Missing the fact that either the grep utility is missing or
the expectation of having the AC_INIT macro in configure.ac is unmet
should never go unnoticed as it always requires user intervention.

[1]: https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Initializing-configure.html
[2]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_271

Closes GH-16717.
2024-11-09 14:03:04 +01:00
DanielEScherzer
e34eebb854
GDB: format output for class entries and class constants (#15955)
For `zend_string` pointers in class entries, show the string contents (if not
`NULL`).

For class constants, the `ce` (class entry pointer) field is shown with the
name of the class, and the `doc_comment` field is shown with the string
contents if possible.
2024-10-09 13:10:48 +02:00
Niels Dossche
31e2ec63d8
Fix GH-15923: GDB: Python Exception <class 'TypeError'>: exceptions must derive from BaseException
Triggers on release builds when printing data structures.
You can't raise a string, you must raise exceptions.

Closes GH-15928.
2024-09-17 19:24:18 +02:00
Arnaud Le Blanc
c21899a9f0
Merge branch 'PHP-8.3'
* PHP-8.3:
  Do not remove -O0 in the middle of a flag
  Fix removal of optimization cflags in debug builds (#9647)
2024-09-12 13:12:51 +02:00
Arnaud Le Blanc
c639614346
Do not remove -O0 in the middle of a flag
Fixes GH-15826
Closes GH-15828

Co-authored-by: Peter Kokot <petk@php.net>
2024-09-12 13:08:54 +02:00
Arnaud Le Blanc
60c2687712
Fix removal of optimization cflags in debug builds (#9647)
Discard known '-O' flags, including just '-O', but do not remove only '-O' in '-Ounknown'
2024-09-12 13:08:44 +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
Peter Kokot
4e193b4113
Autotools: Move abs_srcdir and abs_builddir to init macro (#15537)
This syncs the abs_srcdir and abs_builddir variables assignments between
the php-src build and phpize. The `&&` was picked over `;` as it is more
rigorous - the pwd command would fail if cd fails for some reason.
2024-08-22 16:26:48 +02:00
Peter Kokot
40217b2ea4
Autotools: Move auto_cflags marker to PHP_INIT_BUILD_SYSTEM (#15487)
The "hacky" auto_cflags variable is otherwise set only for the Oracle
Developer Studio compiler (which is at this point also non-usable) and
perhaps might be removed in the future but this is for now moved to the
PHP_INIT_BUILD_SYSTEM for consistent settings between the php-src build
and phpize.

The PHP_INIT_BUILD_SYSTEM is now also called sooner in phpize to match
the php-src build.
2024-08-19 22:29:20 +02:00
Peter Kokot
dffe25bd19
Autotools: Move AWK finder to PHP_INIT_BUILD_SYSTEM (#15478)
This calls the PHP_PROG_AWK from a single place for php-src build and
phpize.
2024-08-18 13:30:03 +02:00
Peter Kokot
9fcc1bca8a
Remove redundant middle newlines in "Autotools" related files
This syncs few minor left-overs in "Autotools" related files:
- redundant middle newlines removed (in man pages the duplicate newlines
  are also ignored and are not visible in the man page anyway)
- Minor mixed indentation synced

[skip ci]
2024-08-12 13:18:32 +02:00
Peter Kokot
84e1920c12
Autotools: Add phpized configure log and help separators (#15251)
- This quotes all PHP_CONFIGURE_PART arguments
- When configuring and building extensions with phpize, this makes the
  './configure --help' and './configure' log output a bit more readable
  as it separates the extension configuration, Libtool configuration and
  the rest of the Autoconf and phpize configuration options.
- The ./configure output separators bold tags are moved to the
  PHP_INIT_BUILD_SYSTEM macro to be available also in phpized extensions
- The obsolete ticks `...` converted to the recommended $(...); Autoconf
  configure re-executes itself in shells where the $(...) still wouldn't
  work ok. For example, the default, initial, non-updated shell on
  Solaris 10.
- Empty new lines in help separators synced (Autoconf default separators
  don't include additional empty newline after the separator title);
  so the PHP_HELP_SEPARATOR additional empty line is also removed
  (see './configure --help' output)
2024-08-06 22:15:22 +02:00
Peter Kokot
62f75a7812
Autotools: Refactor thread safety checks (#15214)
- The ZTS is defined on only one place
- Added help text for ZTS preprocessor macro
- The 'enable_zts' variable replaced with PHP_THREAD_SAFETY in
  configure.ac.
- Nits fixed.
2024-08-05 22:30:10 +02:00
Peter Kokot
18a99a4d33
Autotools: Refactor debug checks (#15215)
- Added help text for ZEND_DEBUG preprocessor macro
- CS synced
2024-08-04 21:59:58 +02:00
Peter Kokot
9467ffb43c
Autotools: Remove obsolete config.status invocations (#15185)
This was once added to fix the bug https://bugs.php.net/13561 because
the phpize and php-config scripts were located in the pear subdirectory
and were installed only when --with-pear option was used. Then in the
20c43285f7 scripts were moved to scripts
subdirectory with this mechanism used in the generated Makefile when
running 'make install' command.

Before the AC_CONFIG_FILES was introduced to Autoconf AC_OUTPUT once
accepted arguments. This signature is obsolete in current Autoconf
versions.

The old obsolete config.status invocation:
  CONFIG_FILES=... ./config.status

And the new invocation is (if used with AC_CONFIG_FILES in the code):
  ./config.status --file=...

Instead, this simply removes the redundant phpize and php-config
generation with the old obsolete config.status invocations as these
files are always generated in the php-src build context.
2024-08-02 12:35:11 +02:00
Peter Kokot
fa7ee84f0b
Autotools: Quote PHP_CONFIG_NICE arguments 2024-07-26 09:58:59 +02:00
Peter Kokot
d59691c02f
Autotools: Move php_shtool variable initialization to PHP_INIT_BUILD_SYSTEM (#14904)
As this script is still needed across the PHP build system its path can
be also set on once place for both phpize usage and regular php-src's
configure.ac.
2024-07-10 21:15:02 +02:00
Calvin Buckley
3618382d07
Handle BSD checksum and file utilities (#14690)
* Handle BSD checksum utilities

The BSDs have different checksum utilities than GNU systems do. If we
don't see the GNU checksum utilities installed, use the BSD ones, as
their output is compatible enough.

Addresses part of GH-14688.

* Prefer GNU touch

BSD touch at least in macOS does not handle local timezone in the
timestamp (like 2024-06-27T10:26:23-03:00). As such, try GNU touch (as
ports systems almost always prefix with g if coreutils is installed) and
prefer that if available. It's not the end of the world though if GNU
touch isn't available, as BSD touch on some systems may support it, and
if it doesn't, then it's just timestamps, nothing too serious.
2024-07-08 13:27:47 -03:00
Peter Kokot
083493be57
Fix AS_VAR_* checks (#14868)
AS_VAR_SET_IF doesn't behave the same as "test -n" and/or "test -z",
which becomes an issue for Apache's ZTS automatic enabling and CFLAGS
edge case where it would be explicitly set to empty value. It is safer
to use AS_VAR_IF instead of AS_VAR_SET_IF in these cases.
2024-07-08 14:20:58 +02:00
Peter Kokot
2ebef11e83
Update http links to https and sync www.php.net URLs (#14854) 2024-07-07 04:23:08 +02:00
Andy Postnikov
1f64e7c253
Fix build for armv7 (#14801) 2024-07-06 15:21:45 +02:00
Peter Kokot
17ef4b7ced
Autotools: Sync CS in phpize and configure.ac (#14838)
- This syncs Autoconf syntax with AS_VAR_* macros in phpize and
  configure.ac
- The cross-compiling check synced with configure.ac (the check message
  printed after program check message)
- Some redundant quoting removed
2024-07-06 13:35:14 +02:00
Peter Kokot
1f2948a966
Sync PHP_SUBST in phpize.m4 (#14756)
- Arguments quoted
- Duplicate redundant prefix variable substitution removed
2024-07-01 23:15:44 +01:00
Peter Kokot
212b2834e9
Autotools: Sync indentation style in build system files (#14725) 2024-06-29 23:25:17 +02:00
Peter Kokot
604e0a7bbe
Fix negation in shell tests (#14662)
According to documentation the `if test ! ...` is preferred to
`if ! test ...`. The later is not portable:
https://www.gnu.org/software/autoconf/manual/autoconf-2.72/autoconf.html
2024-06-25 23:31:08 +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
cf3b9fca8f
Sync #if/ifdef/defined (-Wundef) (#14623)
These are either define (to value 1) or undefined:
- __GNUC__
- DBA_CDB_BUILTIN
- DBA_GDBM
- HAVE_FORK
- HAVE_PUTENV
- HAVE_SETENV
- HAVE_SYS_SELECT_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_WAIT_H
- HAVE_UNSETENV
- RFC3678_API
- ZEND_ENABLE_ZVAL_LONG64
- ZTS

Follow-up of GH-5526
2024-06-24 19:37:07 +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
Arnaud Le Blanc
182fee1447
Fix removal of optimization cflags in debug builds (#9647)
Discard known '-O' flags, including just '-O', but do not remove only '-O' in '-Ounknown'
2024-05-22 13:22:34 +02:00
Ilija Tovilo
1c30c5e707
Print location on class redeclaration
Fixes GH-13950
Closes GH-13999
2024-04-30 14:34:43 +02:00
Peter Kokot
7d6bb3e86d
Fix extension_dir variable quoting in php-config (#13963)
When configuring the build with:

    ./configure EXTENSION_DIR="\${prefix}/lib/php/20230901"

The $prefix variable wasn't replaced when running the installed script:

    php-config --extension-dir

It shows ${prefix}/lib/php/20230901 instead of
/usr/local/lib/php/20230901 because of single quotes.
2024-04-16 19:07:49 +02:00
Arnaud Le Blanc
46b6ad6dae
Inline GDB scripts in the PHP binary (#13600)
This inlines .gdbinit and php_gdb.py in the .debug_gdb_scripts section of the PHP binary so that GDB can auto-load them regardless of the current directory or the availability of the PHP source code (albeit some functionalities of php_gdb.py currently rely on the source being available).
2024-04-16 15:10:01 +02:00
Tim Düsterhus
08b2ab22f4
Include the source location in Closure names (#13550)
* Include the source location in Closure names

This change makes stack traces involving Closures, especially multiple
different Closures, much more useful, because it's more easily visible *which*
closure was called for a given stack frame.

The implementation is similar to that of anonymous classes which already
include the file name and line number within their generated classname.

* Update scripts/dev/bless_tests.php for closure naming

* Adjust existing tests for closure naming

* Adjust tests for closure naming that were not caught locally

* Drop the namespace from closure names

This is redundant with the included filename.

* Include filename and line number as separate keys in Closure debug info

* Fix test

* Fix test

* Include the surrounding class and function name in closure names

* Fix test

* Relax test expecations

* Fix tests after merge

* NEWS / UPGRADING
2024-04-12 18:21:13 +02:00
Tim Düsterhus
98b43d07f9
Merge branch 'PHP-8.3'
* PHP-8.3:
  makedist: Reset tar timestamps to the commit date (#13879)
2024-04-04 13:26:47 +02:00
Tim Düsterhus
c89d797a41
makedist: Reset tar timestamps to the commit date (#13879)
This change should make the underlying `.tar` archive fully reproducible (given
identical tool versions).
2024-04-04 13:26:27 +02:00