* 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
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>
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.
* 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)
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.
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.
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.
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.
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.
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.
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]
- 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)
- 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.
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.
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.
* 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.
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.
- 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
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.
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.
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).
* 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