Commit Graph

397 Commits

Author SHA1 Message Date
Alex Dowad
7a9f0cc3d0 Simplify _crypt_extended_init_r, and fix redundant initialization on Win32/Solaris
Looking at the history of this function, the original implementation had a bug where
it would return from the middle of the function without unlocking the mutex first.
The author attempted to fix this by incrementing the `initialized` flag atomically,
which is not necessary, since the section which modifies the flag is protected by a
mutex.

Coincidentally, at the same time that all this unnecessary 'atomic' machinery was
introduced, the code was also changed so that it didn't return without unlocking the
mutex. So it looks like the bug was fixed by accident.

It's not necessary to declare the flag as `volatile` either, since it is protected
by a mutex.

Further, the 'fixed' implementation was also wrong in another respect: on Windows
and Solaris, the `initialized` flag was not even declared as `static`!! So the
initialization of the static tables for S-boxes, P-boxes, etc. was repeated on
each call to `php_crypt`, completely defeating the purpose of this function.
2020-06-23 16:10:54 +02:00
Christoph M. Becker
91982bad63 7.3 is now 7.3.21-dev 2020-06-23 10:29:42 +02:00
Derick Rethans
13f9f874a7 PHP-7.4 is now 7.4.9-dev 2020-06-23 08:46:37 +01:00
Alex Dowad
7e2147be23 Clean up some unused code (and fix some comments) in build scripts
- Fix typo in build/php.m4

- Nothing uses HAVE_INTTYPES_H; so remove check for header file

- Nothing defines ZEND_ACCONFIG_H_NO_C_PROTOS; so remove #ifndef

- `format_money` was removed in 2019, so <monetary.h> no longer needed

- Nothing uses HAVE_NETDB_H; so remove check for header file

- Nothing checks HAVE_TERMIOS_H; so remove check for header file

    (This was actually added when Wez Furlong was adding the original implementation of
    PTY support in `proc_open`, since replaced.)

- Nothing checks HAVE_SYS_AUXV_H; so remove check for header file

- PHP_BUILD_DATE variable is not used for anything, so remove it

    This variable was added to the Makefile, but from there, was not used for anything.
    The comments suggest it was intended to allow 'reproducible builds'. Presumably,
    this means that if a bug is found in a PHP binary somewhere, one could look at the
    Makefile which it was built from, see the date, and then could check the same
    code version out from source control. But... there can easily be multiple commits
    to the repo in the same day. Also, what makes us think that the Makefile which a
    binary was built from will be easily available?

    Besides, ext/standard/info.c already embeds the build date and time in each binary...
    but it does it using `__DATE__` and `__TIME__` (see `php_print_info`).

- Nothing checks HAVE_FINITE; so don't check for function

- Grammar fix to comment in build/php.m4

- Nothing sets $php_ldflags_add_usr_lib variable in configure, so remove conditional

    This was added in 2002, when Rasmus was having difficulty building PHP on some
    host and needed to have /usr/lib in the rpath. It was never documented and
    probably has never been used by anyone else.
2020-06-19 22:04:52 +02:00
David Carlier
bb61346580 Fix Haiku build
getrusage supports only two fields. The network api sits in the network lib.

Closes GH-5732.
2020-06-19 17:21:55 +02:00
Alex Dowad
3a19726bce Remove unneeded --disable-inline-optimization build parameter
In 1999, inline optimization was turned off by default. The commit log indicates this was
done because GCC was running out of memory on some hosts when building the Zend executor.
In 2003, inline optimization was re-enabled by default, but a build option was added to
turn it off if one runs out of memory when building.

Computing hardware has come a long way since 2003 and I doubt that anyone is running out
of memory when building PHP now.

Interestingly, this code set an unused variable called `INLINE_CFLAGS`. It actually
disabled inline optimization by adding -O0 to the build command, not using `INLINE_CFLAGS`.

Just to see how much memory GCC/Make are using when building PHP, I tried building with
successively higher values of `ulimit -v` until it succeeded. Interestingly, while most
of the codebase can be built with about 400MB of memory, ext/fileinfo/libmagic/apprentice.c
requires 1.2GB, doubtless because it includes ext/fileinfo/data_file.c, which is more
than 350,000 lines long. That is with GCC 7.5.0.

Most users get PHP as a binary package anyways, so the question is, are *packagers*
of PHP trying to build on machines with just 1GB RAM? And would they want to package
a PHP interpreter built with *no optimizations*? I can't imagine either being true.
2020-06-17 19:31:35 +02:00
Nikita Popov
1d8233877c Merge branch 'PHP-7.4'
* PHP-7.4:
  Allow defining of uname value for reproducible builds
2020-06-07 10:38:50 +02:00
Jelle van der Waa
d21b1c5679 Allow defining of uname value for reproducible builds
Extend configure.ac to accept PHP_UNAME as env variable to set the value of the
PHP_UNAME define in a reproducible manner. This allows distributions to set a
fixed value for php_uname and keep the default behaviour if PHP_UNAME is not
set.

Motivation: https://reproducible-builds.org/

Closes GH-5671.
2020-06-07 10:38:43 +02:00
Benjamin Eberlei
a7908c2d11 Add Attributes
Co-authored-by: Martin Schröder <m.schroeder2007@gmail.com>
2020-06-04 18:19:49 +02:00
Christoph M. Becker
c249f593ef 7.3.20 will be next 2020-05-26 10:53:22 +02:00
Nikita Popov
e852944f63 Add --enable-memory-sanitizer flag
This flag enabled msan late in the pipeline, so that it does
not affect configure checks.

Otherwise we get a false positive report for openpty availability
without -lutil, which will then result in infinite recursion if
actually called.

This also sets origin tracking to 2, so bump the timeout to 90
minutes.
2020-05-20 16:46:28 +02:00
Christoph M. Becker
c4badcbec4 Bump version
Seems that has been forgotten.
2020-05-19 17:24:18 +02:00
Alex Dowad
a84cd96e86 Add PTY support to proc_open (again after 16 long years)
Back in 2004, a feature was added to proc_open which allowed it to open a PTY,
connecting specific FDs in the child process to the slave end of the PTY and returning
the master end of the PTY (wrapped as a PHP stream) in the `$pipes` array. However,
this feature was disabled just about a month later. Little information is available
about why this was done, but from talking to the original implementer, it seems there
were portability problems with some rare flavors of Unix.

Re-enable this feature with a simplified implementation which uses openpty(). No
attempt is made to support PTYs if the platform does not have openpty(). The configure
script checks if linking with -lutil is necessary to use openpty(), but if anything
else is required, like including some special header or linking with some other library,
PTY support will be disabled.

The original PTY support for proc_open automatically daemonized the child process
(disassociating it from the TTY session and process group of the parent). However,
I don't think this is a good idea. Just because a user opens a child process in a
PTY, it doesn't mean they want it to continue running even when the parent process
is killed. Of course, if the child process is some kind of server, it will likely
daemonize itself; but we have no reason to preempt that decision.

It turns out that since 2015, there has been one test case for PTY support in
proc_open() in the test suite. This test was added in GitHub PR #1588
(https://github.com/php/php-src/pull/1588). That PR mentioned that the PHP
binary in the Debian/Ubuntu repositories is patched to *enable* PTY support. Checking
the Debian PHP repository (https://salsa.debian.org/php-team/php.git) shows that this
is still true. Debian's patch does not modify the implementation from 2004 in any
way; it just removes the #if 0 line which disables it.

Naturally, the test case is skipped if PTY support is not enabled. This means that ever
since it was added, every test run against the 'vanilla' PHP codebase has skipped it.

Interestingly, the test case which was added in 2015 fails on my Linux Mint PC... both
with this simplified implementation *and* when enabling the original implementation.
Investigation reveals the reason: when the child process using the slave end of the
PTY exits and its FDs are all closed, and all buffered data is read from the master
end of the PTY, any further attempt to read from the master end fails with EIO. The
test case seems to expect that reading from the master end will always return an
empty string if no data is available.

Likely this is because PHP's fread() was updated to report errors from the underlying
system calls only recently.

One way out of this dilemma: IF at least one FD referring to the slave end of the PTY is
kept open *in the parent process*, the failure with EIO will not occur even after the child
process exits. However, that would raise another issue: we would need a way to ensure the FD
will be closed eventually in long-running programs.

Another discovery made while testing this code is that fread() does not always return
all the data written to the slave end of the PTY in a single call, even if the data was
written with a single syscall and it is only a few bytes long.

Specifically, when the child process in the test case writes "foo\n" to the PTY, the parent
sometimes receives "foo" (3 bytes) and sometimes "foo\r\n" (5 bytes). (The "\r" is from the
TTY line discipline converting "\n" to "\r\n".) A second call to fread() does return the
remaining bytes, though sometimes all the data is read in the first call, and by the time
the second call is made, the child process has already exited. It seems that liberal use
of the @ operator is needed when using fread() on pipes.

Thanks to Nikita Popov for suggesting that we should just use openpty() rather than
grantpt(), unlockpt(), etc.
2020-05-14 10:25:37 +02:00
Nikita Popov
ae5ca5459f Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix lcov genhtml: ERROR: cannot read [file]
  Properly detect CRC32 APIs on aarch64 from configure
2020-05-14 09:39:03 +02:00
Ondřej Surý
d4bebc874b Properly detect CRC32 APIs on aarch64 from configure
The CRC32 APIs are optional for armv8-a. They became mandatory since
armv8.1-a.

Closes GH-5564.
2020-05-14 09:38:05 +02:00
Nikita Popov
5dc9418a97 Reapply "Remove configure checks for supported instruction sets"
I reverted this previously for 7.4 because of bug #78769. Relanding
it now for master, because I still believe that this change is
right, and if it causes complications, those indicate a bug elsewhere.

---

These were checking whether the instruction set is supported by
the host CPU, however they were only used to condition on whether
this instruction set is targeted at all. It would still use dynamic
dispatch (e.g. based on ifunc resolvers) to select the actual
implementation. Whether the target is guaranteed to support the
instruction set without dispatch is determined based on pre-defined
macros like __SSE2__.

This removes the configure-time builtin cpu checks to remove
confusion. Additionally this allows targeting an architecture that
is newer than the host architecture.
2020-05-11 12:22:28 +02:00
Christoph M. Becker
6998cc5029 Bump version 2020-04-28 09:10:50 +02:00
Alex Dowad
77ee4e63a6
Nothing in codebase cares whether platform has fpclass()
Therefore, don't bother checking for it in 'configure' script.

Closes GH-5453
2020-04-24 21:39:55 +02:00
Derick Rethans
01634f8410 The 7.4 branch is now for 7.4.6 2020-03-31 14:57:12 +01:00
Christoph M. Becker
33226c3a17 Next is 7.3.18 2020-03-31 10:22:55 +02:00
George Peter Banyard
457380cae7 Drop wchar header check as always defined since C95 2020-03-31 00:14:56 +02:00
Nikita Popov
e8e09b60b4 Remove rand_r implementation
We already use our own mt13397 implementation nowadays, so we no
longer need this shim.
2020-03-26 11:49:27 +01:00
Nikita Popov
97cb81ead5 Remove HAVE_REALPATH checks
We do not actually use realpath(), but a custom implementation.
Make sure the realpath() function is always available.

Closes GH-5290.
2020-03-26 11:46:00 +01:00
Nikita Popov
f0f2493208 Merge branch 'PHP-7.4'
* PHP-7.4:
  Check for sys/auxv.h before using it.
2020-03-10 16:54:17 +01:00
Peter Seiderer
f73528f0e0 Check for sys/auxv.h before using it.
Fixes aarch64 compile with uclibc-ng (does not provide
sys/auxv.h header file).

Closes GH-5248.

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
2020-03-10 16:53:57 +01:00
Derick Rethans
dc3e3e64f2 PHP-7.4 is now 7.4.5-dev 2020-03-03 11:29:10 +00:00
Christoph M. Becker
9dda3b9eb2 Next is 7.3.17 2020-03-03 10:19:31 +01:00
Nikita Popov
84854a72c7 Remove mergesort implementation
php_mergesort() isn't being used for anything, and hasn't been for
a long time. Even if we wanted to use a stable sort, this isn't
the implementation we'd use...
2020-02-27 10:36:01 +01:00
Nikita Popov
172010a08d Merge branch 'PHP-7.4'
* PHP-7.4:
  Don't use VLA in mysqlnd auth
2020-02-18 16:18:50 +01:00
Nikita Popov
9d31a42a30 Don't use VLA in mysqlnd auth
We use alloca instead of VLA. This should also allow building
this code on Windows.
2020-02-18 16:17:56 +01:00
Christoph M. Becker
e3632fdc0d Next is 7.3.16 2020-02-04 11:38:29 +01:00
Dmitry Stogov
8bdce8edab Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79092 (Building with clang+lld-9 results in a broken PHP binary)
2020-01-29 12:15:34 +03:00
Dmitry Stogov
ce44cd3b3c Fixed bug #79092 (Building with clang+lld-9 results in a broken PHP binary) 2020-01-29 12:15:03 +03:00
Christoph M. Becker
d684f5fdc0 Fix #79086: Bump version not applied
We must not forget to update the version in configure.ac as well.
2020-01-09 09:25:52 +01:00
Christoph M. Becker
38c0a53b60 Bump version 2020-01-07 11:03:19 +01:00
Derick Rethans
2badeb511b PHP-7.4 is now 7.4.2-dev 2019-12-10 16:56:33 +00:00
George Peter Banyard
1c4ad17cc1 Move isinf, isnan, and isfinite to zend_portability.h
Closes GH-4966
2019-12-05 14:27:51 +01:00
Máté Kocsis
144b41ce88
Remove money_format() function 2019-12-05 13:15:54 +01:00
George Peter Banyard
92d5a2e48c Remove obsolete configure checks for isinf, isnan, and isfinite 2019-12-04 15:17:57 +01:00
Christoph M. Becker
65bbc67063 Next is 7.3.14 2019-12-03 12:04:17 +01:00
Derick Rethans
e99406f4d1 PHP-7.4 is now 7.4.1-dev 2019-11-15 14:22:14 +00:00
Christoph M. Becker
34dda406bd Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78788: ./configure generates invalid php_version.h
2019-11-07 10:01:43 +01:00
max
0988f69634 Fix #78788: ./configure generates invalid php_version.h
Change $SED to "${SED}" such that the IFS is not used to split the
output of that variable.
2019-11-07 10:01:02 +01:00
Christoph M. Becker
4c9ba3e042 7.3.13 is next 2019-11-05 18:20:56 +01:00
Nikita Popov
b509d67554 Merge branch 'PHP-7.4'
* PHP-7.4:
  Revert "Remove configure checks for supported instruction sets"
2019-11-04 11:34:02 +01:00
Nikita Popov
451314111b Revert "Remove configure checks for supported instruction sets"
This reverts commit edccf32f7f.

This was reported to cause issues for as yet unknown reasons in
bug #78769. As this was intended as code cleanup, revert this from
7.4 at least. May reapply it to master later.
2019-11-04 11:32:46 +01:00
Nikita Popov
1517bc4426 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove configure checks for supported instruction sets
2019-10-31 11:34:15 +01:00
Nikita Popov
edccf32f7f Remove configure checks for supported instruction sets
These were checking whether the instruction set is supported by
the host CPU, however they were only used to condition on whether
this instruction set is targeted at all. It would still use dynamic
dispatch (e.g. based on ifunc resolvers) to select the actual
implementation. Whether the target is guaranteed to support the
instruction set without dispatch is determined based on pre-defined
macros like __SSE2__.

This removes the configure-time builtin cpu checks to remove
confusion. Additionally this allows targeting an architecture that
is newer than the host architecture.
2019-10-31 11:27:53 +01:00
Nikita Popov
ad53bacf38 Fix bug #78681 by renaming libphp8.so to libphp.so
The major version number is no longer included.
2019-10-29 16:06:09 +01:00
Nikita Popov
393aa057d3 Merge branch 'PHP-7.4' 2019-10-11 16:51:50 +02:00
Nikita Popov
3718a95526 Remove configure checks for ltp when using --enable-gcov
gcov builds can also be used with other tools like gcovr, so remove
the hard dependency on LTP.
2019-10-11 16:51:03 +02:00
Dmitry Stogov
33958ccb36 Revert "Fixed CLI/CGI/FPM build, when they are built together with Apache SAPI"
This reverts commit db094b4b2e.
2019-10-10 16:28:59 +03:00
Christoph M. Becker
26f45cb4bb 7.3.12 is next 2019-10-08 12:04:25 +02:00
Dmitry Stogov
50527aa49b Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed CLI/CGI/FPM build, when they are built together with Apache SAPI
2019-09-17 15:44:40 +03:00
Dmitry Stogov
db094b4b2e Fixed CLI/CGI/FPM build, when they are built together with Apache SAPI 2019-09-17 15:43:00 +03:00
Nikita Popov
c4e2ca607f Various improvements to fuzzer SAPIs 2019-09-16 16:04:10 +02:00
Christoph M. Becker
cf31210f29 PHP 7.3.10RC1 has been tagged 2019-09-10 15:11:54 +02:00
Florian Weimer
aeaab8ee3e Port various autoconf bits to C99 compilers
C99 no longer has implicit function declarations and implicit ints.
Current GCC versions enable them as an extension, but this will
change in a future GCC version.
2019-09-10 12:32:14 +02:00
Peter Kokot
9bd0cce819 Merge branch 'PHP-7.4'
* PHP-7.4:
  Update NEWS
  Fix #78460: PEAR installation failure
2019-08-30 04:32:30 +02:00
Peter Kokot
18a2f0849f Fix #78460: PEAR installation failure
When building PHP outside of the source tree:

  mkdir custom-build-dir
  cd custom-build-dir
  ../path/to/php-src/configure

The directories need to be manually created including the pear directory
so the pear installation PHAR file doesn't need to be downloaded from
the remote location.

Closes GH-4639
2019-08-30 04:26:05 +02:00
Christoph M. Becker
5536105b67 Next will be 7.3.10 2019-08-13 23:57:48 +02:00
Christoph M. Becker
fe7997912d Bump version numbers
This should have been done four weeks ago already.
2019-08-13 23:23:43 +02:00
Peter Kokot
452356af2a Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove outdated Libtool hack for macs
2019-07-24 21:43:26 +02:00
Peter Kokot
793dfa91bb Remove outdated Libtool hack for macs
This was once relevant for older versions of macs and autoconf 2.13.

Closes GH-4435
2019-07-24 21:40:21 +02:00
Peter Kokot
605386e394 Remove HAVE_LOCALE_H and locale.h check
This was a left over for supporting old code in PHP extensions out there.
Check is not needed anymore since this is part of C89+ standard.

Closes GH-4445
2019-07-21 00:37:47 +02:00
Peter Kokot
f33d12096d Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove duplicate socklen_t check
2019-07-18 12:11:45 +02:00
Peter Kokot
bbdbc2658c Remove duplicate socklen_t check
- Use Autoconf's default AC_CHECK_TYPES

Closes GH-4418
2019-07-18 12:11:19 +02:00
Peter Kokot
b40be8751a Merge branch 'PHP-7.4'
* PHP-7.4:
  Update changelog
  Remove unused build checks
2019-07-16 22:47:02 +02:00
Peter Kokot
63d6a2b697 Remove unused build checks
- yp_get_default_domain was part of ext/yp
- functions checks produce HAVE_function_name symbols. These checks are
  currently not used in php-src neither in the extensions out there.
- Removed symbols because they are not used in the code:
  - HAVE_GCVT
  - HAVE_PUTENV
  - HAVE_PUTENV
  - HAVE_SETVBUF
  - HAVE_TEMPNAM
  - HAVE_SIN (sin is also defined in C89 standard)
  - HAVE_SETSOCKOPT
  - HAVE_LOCKF
  - HAVE_ISASCII
  - HAVE_YP_GET_DEFAULT_DOMAIN (and other yp extension related unused checks)
  - HAVE_LINK
- HAVE_USLEEP is already defined in Windows configuration header
- HAVE_LIBBIND has not been used in php-src for a while anymore
- HAVE_GETHOSTNAME is duplicated in Windows configuration header

Closes GH-4417
2019-07-16 22:39:09 +02:00
Peter Kokot
5284645fc3 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove usage of PHP_AIX_LDFLAGS
2019-07-14 23:45:13 +02:00
Peter Kokot
93b3d2f6ee Remove usage of PHP_AIX_LDFLAGS
These are currently not defined since their usage has been removed via
51ca2dba53
and
53349d69dd
2019-07-14 23:44:01 +02:00
Peter Kokot
5ca149d192 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove duplicate PTHREADS template define
2019-07-14 14:46:55 +02:00
Peter Kokot
66c02cc0a1 Remove duplicate PTHREADS template define
The undef PTHREADS converts to define if thread safety is configured.
This step is already done by pthreads m4 macros from TSRM so this now
removes duplicated PTHREADS defines from php_config.h.
2019-07-14 14:45:27 +02:00
Peter Kokot
567b602bcf Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove PHP_MYSQL variable
2019-07-14 13:49:18 +02:00
Peter Kokot
7a6d737de7 Remove PHP_MYSQL variable
PHP_MYSQL variable was once defined by the ext/mysql (--with-mysql).

Closes GH-4399
2019-07-14 13:48:44 +02:00
Peter Kokot
16e64cb5e3 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove php_multiple_shlib_versions_ok
2019-07-13 15:06:53 +02:00
Peter Kokot
4e0af6d862 Remove php_multiple_shlib_versions_ok
Variable usage was removed via
913cec6551
2019-07-13 15:06:35 +02:00
Peter Kokot
71bd212d0e Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove WARNING_LEVEL fix for QNX
2019-07-13 14:40:17 +02:00
Peter Kokot
499f2ac132 Remove WARNING_LEVEL fix for QNX
Fix is no longer relevant since the environment variable WARNING_LEVEL
is no longer used to define the value of the -w option for cc.

Closes GH-4398
2019-07-13 14:39:29 +02:00
Nikita Popov
98495f7f30 Merge branch 'PHP-7.4' 2019-07-12 13:14:38 +02:00
Nikita Popov
709897c2a5 Remove unused tsrm_strtok_r() function
There is also a php_strtok_r() function, which is actually used,
but nothing uses the tsrm_strtok_r() variant...
2019-07-12 13:14:24 +02:00
Peter Kokot
1a935e2662 Merge branch 'PHP-7.4'
* PHP-7.4:
  Refactor undefining PACKAGE_* symbols
2019-07-11 02:02:01 +02:00
Peter Kokot
a6daded1a4 Refactor undefining PACKAGE_* symbols
Instead of patching configuration headers template generated by
the given tools - autoheader, this moves patching these symbols to
the configure step before creating and invoking the config.status
and before the configuration header file is generated from the
patched template.

Closes GH-4374
2019-07-11 02:00:51 +02:00
Nikita Popov
d63b91db60 Merge branch 'PHP-7.4' 2019-07-10 15:19:43 +02:00
Cyril Pascal
6791107319 Align segments on huge page boundary only for x86
Closes GH-4387.
2019-07-10 15:19:24 +02:00
Peter Kokot
e676aef56a Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove APACHE symbol
2019-07-08 15:06:54 +02:00
Peter Kokot
4b864c2ebb Remove APACHE symbol
The APACHE symbol was used in very early PHP versions to indicate the
Apache module usage. Since PHP 4 this is no longer used in the code.
2019-07-08 15:05:54 +02:00
Peter Kokot
61809b19f7 Merge branch 'PHP-7.4'
* PHP-7.4:
  Refactor genif.sh
2019-07-08 14:59:40 +02:00
Peter Kokot
900de30b0f Refactor genif.sh
Changes:
- Coding style fixes
- ${1+"$@"} replaced with "$@" [1]
- EXTRA_MODULE_PTRS variable is not used anymore
- awk tool defined via environment variable
- srcdir determined automatically from the genif.sh location

[1] https://www.in-ulm.de/~mascheck/various/bourne_args/

Closes GH-4372
2019-07-08 14:58:26 +02:00
Peter Kokot
da54b1c20e Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove C89 checks for signal.h and strerror
2019-07-08 12:47:35 +02:00
Peter Kokot
550c2aa89b Remove C89 checks for signal.h and strerror
These are part of the C89 and on today's systems not needed to be
checked anymore. This removes symbols HAVE_SIGNAL and HAVE_STRERROR.

- http://port70.net/~nsz/c/c89/c89-draft.html
- locale.h is also part of C89 but will be removed per request in PHP 8
2019-07-08 12:46:51 +02:00
Peter Kokot
c752b74665 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove some unused variables
2019-07-08 10:20:14 +02:00
Peter Kokot
5ba69ab3ad Remove some unused variables
- Variables php_abs_top_srcdir php_abs_top_builddir are no longer used.
- ZEND_EXT_TYPE is always zend_extension and variable is no longer used.

Closes GH-4378
2019-07-08 10:18:17 +02:00
Peter Kokot
04f9a523eb Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove PHP_DEBUG_MACRO
2019-07-07 12:16:14 +02:00
Peter Kokot
3bde4838f4 Remove PHP_DEBUG_MACRO
The macro is no longer used. The warning at the end of the configure
script therefore is also no longer used.
2019-07-07 12:15:36 +02:00
Peter Kokot
35709b56e4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove some more Apache 1 left overs
2019-07-07 12:10:59 +02:00
Peter Kokot
49cc2a63b3 Remove some more Apache 1 left overs
- warning in configure.ac is relevant for the sapi/apache
- errors output redirected to /dev/null when checking Apache version
2019-07-07 12:09:19 +02:00
Peter Kokot
0707caf163 Merge branch 'PHP-7.4'
* PHP-7.4:
  Move footer to the end of configure output
2019-07-06 04:55:42 +02:00
Peter Kokot
539b577827 Move footer to the end of configure output 2019-07-06 01:00:24 +02:00
Peter Kokot
b36b6c5fdf Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove PTHREADS_ASSIGN_VARS
2019-07-05 23:30:51 +02:00
Peter Kokot
1c9e8e8f6a Remove PTHREADS_ASSIGN_VARS
This simplifies TSRM build steps a bit and avoids doing unnecessary
steps:
- The `PTHREADS_CHECK_COMPILE` can called inside the for loops only
  since this is only where the `$pthreads_checked` variable is used.
- Assigning variables can be then done only in the configure.ac
  once.
- use `m4_include()` instead of the `sinclude()` in the middle of
  the build steps.
- The `$threads_result` variable is not used in the code or in
  extensions.
2019-07-05 23:26:20 +02:00
Peter Kokot
d9630aee79 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove PHP_CHECK_CONFIGURE_OPTIONS
2019-07-02 22:22:07 +02:00
Peter Kokot
16df718251 Remove PHP_CHECK_CONFIGURE_OPTIONS
Instead of building a custom macro for checking configure options,
Autoconf 2.62+ already outputs a warning at the beginning and the end
of the output of configure script. It automatically detects correct
and wrong options better.

This is related also to bug #55634.

So now instead a better way is the default Autoconf approach:

This outputs a warning at the beginning and end of the configure output:

    ./configure --with-non-existing

This results in fatal error:

    ./configure --non-existing

    configure: error: unrecognized option: `--non-existing'
    Try `./configure --help' for more information

The `--enable-option-checking=fatal` results in fatal error for all non
existing options:

    ./configure --with-non-existing --enable-option-checking=fatal

    configure: error: unrecognized options: --with-non-existing

Closes GH-4348
2019-07-02 22:15:24 +02:00
Peter Kokot
e7c028f00c Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove some old BeOS artefacts
2019-07-02 22:10:24 +02:00
Peter Kokot
b1ef50091d Remove some old BeOS artefacts
- checking for beos systems is no longer relevant in configure.ac
- usage of undefined constant BETHREADS removed.

Closes GH-4346
2019-07-02 22:08:54 +02:00
Peter Kokot
0ae28558bc Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove check for ApplicationServices/ApplicationServices.h
2019-07-02 22:05:41 +02:00
Peter Kokot
534351c014 Remove check for ApplicationServices/ApplicationServices.h
The symbol HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H is not used
and check not needed.

Closes GH-4336
2019-07-02 22:05:00 +02:00
Peter Kokot
b757d49cb5 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove TSRM_BASIC_CHECKS
2019-07-01 13:26:17 +02:00
Peter Kokot
30c1c53164 Remove TSRM_BASIC_CHECKS
This macro is not needed anymore. The AC_PROG_CC is done in the main
configure.ac file and the ranlib check is done by the bundled libtool
macros.

Closes GH-4339
2019-07-01 13:23:41 +02:00
Peter Kokot
fa21fda6ab Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove not needed checks for functions
2019-07-01 13:21:44 +02:00
Peter Kokot
e558ee7999 Remove not needed checks for functions
The following functions don't need to be checked anymore since the
they are not used across the code or the symbols aren't used anymore:
- cuserid (not used)
- lrand48 (not used and removed via
  6d6ef7aacc)
- random (check is not used)
- srand48 (not used)
- srandom (not used)
- strdup (check is not used)

and the unused check symbols:
- HAVE_CUSERID
- HAVE_LRAND48
- HAVE_RANDOM
- HAVE_SRAND48
- HAVE_SRANDOM
- HAVE_STRDUP

Closes GH-4338
2019-07-01 13:21:28 +02:00
Peter Kokot
98d0892dd8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Sync functions checks
2019-06-30 23:59:47 +02:00
Peter Kokot
9a3c8e51e3 Sync functions checks
Removed unused checks:
- mbsinit check removed, HAVE_MBSINIT removed (not used in php-src)
- mempcpy check removed, HAVE_MEMPCPY removed (not used in php-src anymore since
  560ed89bfb which uses PHP's own implementation)
- strpncpy check removed, added via a8c9e893b6 and
  not used.
- setpgid check removed since HAVE_SETPGID is not used

Moved to a central configure.ac:
- fpclass
- mbrlen moved to configure.ac (since the HAVE_MBRLEN is used accross the php-src)
- sigprocmask
- getcwd
- getwd
- glob
- strfmon
- nice

Duplicated checks removed:
- gethostname
- getlogin
- getpwuid_r
- socketpair

- mprotect check simplified
2019-06-30 23:57:54 +02:00
Peter Kokot
7ad82d47d3 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove HAVE_LIMITS_H check
2019-06-30 23:46:02 +02:00
Peter Kokot
6c1c66befe Remove HAVE_LIMITS_H check
The limits.h header is part of the C89 and is today available
everywhere. There is no need to check for presence of this header
anymore.

The timelib has already been patched upstream via
aae5907cb7

PHP extensions out there shouldn't rely on symbols defined during the
build anyway and neither they do on this particular symbol anymore.
2019-06-30 23:44:45 +02:00
Peter Kokot
7f994990ea Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove HAVE_STRCOLL check
2019-06-28 00:13:25 +02:00
Peter Kokot
638c21765c Remove HAVE_STRCOLL check
The strcoll function is defined in the C89 standard and should be
on today's systems always available via the <string.h> header.

https://port70.net/~nsz/c/c89/c89-draft.html#4.11.4.3

- Remove also SKIPIF strcoll check in test
2019-06-28 00:05:55 +02:00
Peter Kokot
6bfa6bff0b Merge branch 'PHP-7.4'
* PHP-7.4:
  Clean headers checks
2019-06-27 02:45:31 +02:00
Peter Kokot
2079b09854 Clean headers checks
Some headers were checked multiple times in the main configure.ac file
and in the bundled extensions or SAPIs themselves. Also many of these
checks are then used accross other extensions or SAPIs so a central
configure.ac makes most sense for these checks.
2019-06-27 02:45:09 +02:00
Nikita Popov
6aaab9adf7 Merge branch 'PHP-7.4' 2019-06-20 16:24:31 +02:00
Nikita Popov
6165c23475 Check for dlsym as well
For some reason, when using GCC with address sanitizer, dlopen
is available without -ldl, but dlsym still needs it. Explicitly check
dlsym so we add the library.
2019-06-20 16:23:04 +02:00
Christoph M. Becker
bcf20963c1 Next is 7.3.8 2019-06-11 13:31:30 +02:00
Anatol Belski
8f85961326 Merge branch 'PHP-7.4'
* PHP-7.4:
  Ported limagic 5.37
2019-05-30 02:23:20 +02:00
Anatol Belski
622b10f06e Ported limagic 5.37 2019-05-30 02:22:40 +02:00
Dmitry Stogov
b22cd2284d Merge branch 'PHP-7.4'
* PHP-7.4:
  Align .text segment for better huge pages usage
2019-05-27 13:38:07 +03:00
Dmitry Stogov
62ded6efbc Align .text segment for better huge pages usage 2019-05-27 13:37:19 +03:00
Joe Watkins
f8d53099c9
Merge branch 'PHP-7.4'
* PHP-7.4:
  Use PKG_CHECK_MODULES to detect valgrind, and share build config with pcre
2019-05-25 09:04:37 +02:00
Hugh McMaster
ef34e00df3
Use PKG_CHECK_MODULES to detect valgrind, and share build config with pcre 2019-05-25 09:04:22 +02:00
Christoph M. Becker
2d93cce03a Prepare 7.3.7-dev 2019-05-14 11:44:58 +02:00
Peter Kokot
2cf90bb2f0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Normalize comments in *nix build system m4 files
2019-05-12 18:51:50 +02:00
Peter Kokot
75fb74860d Normalize comments in *nix build system m4 files
Normalization include:
- Use dnl for everything that can be ommitted when configure is built in
  favor of the shell comment character # which is visible in the output.
- Line length normalized to 80 columns
- Dots for most of the one line sentences
- Macro definitions include similar pattern header comments now
2019-05-12 18:43:03 +02:00
Peter Kokot
1e0a4ac10e Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove dead code from configure.ac
2019-05-10 00:44:51 +02:00
Peter Kokot
f7b62b115e Remove dead code from configure.ac
SAPI apache has been removed and now there is apache2handler so this
warning hasn't been used for a while.
2019-05-10 00:44:09 +02:00
Dmitry Stogov
b27f97d858 Merge branch 'PHP-7.4'
* PHP-7.4:
  speed up add and sub operators with overflow detection
2019-05-07 15:38:27 +03:00
Sebastian Pop
adc3b72076 speed up add and sub operators with overflow detection
On A72, google-benchmark measure before and after the patch:
--------------------------------------------------------
Benchmark              Time             CPU   Iterations
--------------------------------------------------------
BM_add_before       13.3 ns         13.3 ns     52626058
BM_sub_before       8.72 ns         8.72 ns     80259343
BM_add_after        4.80 ns         4.80 ns    145926004
BM_sub_after        4.80 ns         4.80 ns    145936496

Before the patch:
fast_long_add_function:
	ldr	x1, [x1]
	ldr	x2, [x2]
	add	x3, x1, x2
	eor	x4, x1, x2
	tbz	x4, #63, .L5
.L2:
	mov	w1, 4
	str	x3, [x0]
	str	w1, [x0, 8]
	ret
	.p2align 2
.L5:
	eor	x4, x1, x3
	tbz	x4, #63, .L2
	scvtf	d0, x1
	scvtf	d1, x2
	mov	w1, 5
	str	w1, [x0, 8]
	fadd	d0, d0, d1
	str	d0, [x0]
	ret

With the patch:
fast_long_add_function:
	ldr    x5, [x1]
	ldr    x6, [x2]
	adds	x5, x5, x6
	bvs	.L2
	mov	w6, 4
	str	x5, [x0]
	str	w6, [x0, 8]
	ret
.L2:
	ldr	x1, [x1]
	mov	w3, 5
	ldr	x2, [x2]
	str	w3, [x0, 8]
	scvtf	d0, x1
	scvtf	d1, x2
	fadd	d0, d0, d1
	str	d0, [x0]
	ret

    php$ ./sapi/cli/php Zend/bench.php

Base:                         Patch:
simple             0.091      simple             0.091
simplecall         0.014      simplecall         0.014
simpleucall        0.041      simpleucall        0.041
simpleudcall       0.045      simpleudcall       0.045
mandel             0.193      mandel             0.193
mandel2            0.229      mandel2            0.229
ackermann(7)       0.044      ackermann(7)       0.044
ary(50000)         0.010      ary(50000)         0.010
ary2(50000)        0.008      ary2(50000)        0.008
ary3(2000)         0.096      ary3(2000)         0.095
fibo(30)           0.149      fibo(30)           0.148
hash1(50000)       0.016      hash1(50000)       0.016
hash2(500)         0.020      hash2(500)         0.020
heapsort(20000)    0.055      heapsort(20000)    0.054
matrix(20)         0.057      matrix(20)         0.057
nestedloop(12)     0.091      nestedloop(12)     0.091
sieve(30)          0.032      sieve(30)          0.032
strcat(200000)     0.010      strcat(200000)     0.010
------------------------      ------------------------
Total              1.199      Total              1.197

    php$ ./sapi/cli/php Zend/micro_bench.php

Base:                                      Patch:
empty_loop         0.051                   empty_loop         0.051
func()             0.181    0.130          func()             0.181    0.130
undef_func()       0.186    0.135          undef_func()       0.186    0.135
int_func()         0.116    0.064          int_func()         0.116    0.064
$x = self::$x      0.235    0.183          $x = self::$x      0.233    0.182
self::$x = 0       0.198    0.147          self::$x = 0       0.198    0.147
isset(self::$x)    0.229    0.178          isset(self::$x)    0.229    0.178
empty(self::$x)    0.231    0.180          empty(self::$x)    0.231    0.180
$x = Foo::$x       0.144    0.093          $x = Foo::$x       0.144    0.093
Foo::$x = 0        0.107    0.056          Foo::$x = 0        0.107    0.056
isset(Foo::$x)     0.140    0.088          isset(Foo::$x)     0.140    0.088
empty(Foo::$x)     0.148    0.097          empty(Foo::$x)     0.148    0.097
self::f()          0.238    0.187          self::f()          0.238    0.187
Foo::f()           0.209    0.158          Foo::f()           0.209    0.158
$x = $this->x      0.123    0.072          $x = $this->x      0.123    0.072
$this->x = 0       0.124    0.073          $this->x = 0       0.124    0.073
$this->x += 2      0.151    0.099          $this->x += 2      0.153    0.101
++$this->x         0.137    0.086          ++$this->x         0.138    0.086
--$this->x         0.137    0.086          --$this->x         0.138    0.086
$this->x++         0.170    0.119          $this->x++         0.172    0.121
$this->x--         0.171    0.119          $this->x--         0.172    0.121
isset($this->x)    0.170    0.119          isset($this->x)    0.170    0.119
empty($this->x)    0.179    0.128          empty($this->x)    0.179    0.128
$this->f()         0.194    0.143          $this->f()         0.194    0.143
$x = Foo::TEST     0.188    0.137          $x = Foo::TEST     0.188    0.136
new Foo()          0.482    0.431          new Foo()          0.479    0.427
$x = TEST          0.109    0.058          $x = TEST          0.109    0.058
$x = $_GET         0.190    0.138          $x = $_GET         0.190    0.139
$x = $GLOBALS['v'] 0.242    0.191          $x = $GLOBALS['v'] 0.242    0.191
$x = $hash['v']    0.196    0.145          $x = $hash['v']    0.196    0.145
$x = $str[0]       0.146    0.094          $x = $str[0]       0.145    0.094
$x = $a ?: null    0.144    0.093          $x = $a ?: null    0.144    0.093
$x = $f ?: tmp     0.174    0.123          $x = $f ?: tmp     0.174    0.123
$x = $f ? $f : $a  0.153    0.101          $x = $f ? $f : $a  0.153    0.101
$x = $f ? $f : tmp 0.148    0.097          $x = $f ? $f : tmp 0.148    0.097
------------------------                   ------------------------
Total              6.143                   Total              6.143
2019-05-07 15:38:17 +03:00
Peter Kokot
465c82b1af Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove TSRM configuration header
2019-04-29 22:35:24 +02:00
Peter Kokot
ce65d2354c Remove TSRM configuration header
TSRM configuration header file was once created by separate autoconf
build system for TSRM and is with the current code not directly needed
like this anymore.
2019-04-29 22:34:43 +02:00
Nikita Popov
4c485586b4 Merge branch 'PHP-7.4' 2019-04-26 09:57:52 +02:00
Nikita Popov
33e8a7b368 Enable -Werror in CI
Add --enable-werror configure option and use it on Travis. It's not
possible to directly use CFLAGS, because it also affects configure
checks which often throw warnings.

We can't enable something similar for Windows builds at this time,
because they throw a lot more warnings.
2019-04-26 09:56:16 +02:00
Peter Kokot
d2e6c1aff1 Merge branch 'PHP-7.4'
* PHP-7.4:
  Move Autoconf Archive macros to a common m4 dir
2019-04-23 20:38:57 +02:00
Peter Kokot
beb58ca128 Move Autoconf Archive macros to a common m4 dir
In PHP the build dir is used as a directory for external macros
including Autoconf Archive macros.
2019-04-23 20:37:31 +02:00
Peter Kokot
028ffddf69 Merge branch 'PHP-7.4'
* PHP-7.4:
  Move acinclude.m4 to build/php.m4
2019-04-23 20:32:03 +02:00
Peter Kokot
4e7064d173 Move acinclude.m4 to build/php.m4
The acinclude.m4 file is in a usual Autotools build processed with
Automake's aclocal tool. Since PHP currently doesn't use Automake and
aclocal this file can be moved into the build directory. PHP build
system currently generates a combined aclocal.m4 file that Autoconf
can processes automatically.

However, a newer practice is writing all local macros in separate
dedicated files prefixed with package name, in PHP's case PHP_MACRO_NAME
and putting them in a common `m4` directory. PHP uses currently `build`
directory for this purpose.

Name `php.m4` probably most resembles such file for PHP's case.

PHP manually created the aclocal.m4 file from acinclude.m4 and
build/libtool.m4. Which is also not a particularly good practice [1], so
this patch also removes the generated alocal.m4 usage and uses
m4_include() calls manually in the configure.ac and phpize.m4 files
manually.

- sort order is not important but can be alphabetical
- list of *.m4 files prerequisites for configure script generation
  updated
- Moving m4_include() before AC_INIT also removes all comments starting
  with hash character (`#`) in the included files.

[1] https://autotools.io/autoconf/macros.html
2019-04-23 20:28:45 +02:00
Peter Kokot
7eb8913e04 Merge branch 'PHP-7.4'
* PHP-7.4:
  Refactor Zend/acinclude.m4 local macro
2019-04-21 15:53:44 +02:00
Peter Kokot
b1d3509e8c Refactor Zend/acinclude.m4 local macro
There is now only a single M4 macro in the legacy acinclude.m4 file. A
separate acinclude file was once used with a standalone Zend engine
building but with current build system this can be simplified a bit.
2019-04-21 15:53:19 +02:00
Christoph M. Becker
5ae49c43dc Prepare main branch for PHP 7.3.6 2019-04-16 11:56:03 +02:00
Peter Kokot
57cfd706e4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove PHP_READDIR_R_TYPE
2019-04-13 04:51:03 +02:00
Peter Kokot
769db42341 Remove PHP_READDIR_R_TYPE
The PHP_READDIR_R_TYPE m4 macro has been removed via
2b28f71891.

HAVE_POSIX_READDIR_R in windows header file is also not needed anymore.
2019-04-13 04:50:05 +02:00
Peter Kokot
8afb3e6856 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove duplicated substitude for Makefile
2019-04-09 02:11:57 +02:00
Peter Kokot
8021d52fb6 Remove duplicated substitude for Makefile
The substitution is already done in the CLI's config.m4 file. Current
SAPIs only provide one PHP_EXECUTABLE variable, i.e. PHP CLI so the one
in the configure.ac can be removed.
2019-04-09 02:09:42 +02:00