Commit Graph

2324 Commits

Author SHA1 Message Date
Peter Kokot
6e825dfe43
Add --enable-phpdbg-debug option on Windows (#14568)
This enables outputting additional debugging messages when running
phpdbg for developing and troubleshooting phpdbg itself. Option was
already added in Autotools and this adds it also to Windows build
system.

Because additional info is printed when running tests, the
--enable-phpdbg-debug option is excluded when building with
--enable-snapshot-build if not provided explicitly.
2024-06-15 14:41:15 +02:00
Niels Dossche
26fcb5f2b2 win32: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Peter Kokot
84a0da1574
Sync #if/ifdef/defined (#14508)
This syncs CPP macro conditions:
- _WIN32
- _WIN64
- HAVE_ALLOCA_H
- HAVE_ALPHASORT
- HAVE_ARPA_INET_H
- HAVE_CONFIG_H
- HAVE_DIRENT_H
- HAVE_DLFCN_H
- HAVE_GETTIMEOFDAY
- HAVE_LIBDL
- HAVE_POLL_H
- HAVE_PWD_H
- HAVE_SCANDIR
- HAVE_SYS_FILE_H
- HAVE_SYS_PARAM_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_TIME_H
- HAVE_SYS_TYPES_H
- HAVE_SYS_WAIT_H
- HAVE_UNISTD_H
- PHP_WIN32
- ZEND_WIN32

These are either undefined or defined to 1 in Autotools and Windows.

Follow up of GH-5526 (-Wundef).
2024-06-09 14:23:41 +02:00
Peter Kokot
f109795852
Sync HAVE_GRP_H definition (#14514)
This syncs the HAVE_GRP_H definition on Windows (manually defined) and
Autotools (checked with AC_CHECK_HEADERS):
HAVE_GRP_H is is either undefined or defined to value 1.
2024-06-09 01:55:27 +02:00
Peter Kokot
cb2c5de3db
Add PHP_SBINDIR (#13363)
The PHP_SBINDIR symbol was defined on *nix systems but never used. This
adds the constant similar to PHP_BINDIR also to PHP. On Windows it is
the value of prefix configuration when PHP was built (same value as
PHP_BINDIR).
2024-05-29 07:04:05 +02:00
Peter Kokot
2f6a210755
Use memmove() unconditionally in the code (#13647)
The memmove() function is C99 standard function [1] and check was left for
the PCRE2 bundled library. It can be simplified by passing the compile
option instead of checking always available function on current systems.
External PCRE2 library on the system doesn't need this.

[1]: https://port70.net/~nsz/c/c99/n1256.html#7.21.2.2
2024-03-09 20:30:08 +01:00
Peter Kokot
713ac3440c
Remove unused config.w32.h.in symbols (#13617)
- CONFIGURATION_FILE_PATH
  Removed via 2cf1b8d345.

- DISCARD_PATH
  Used for the --enable-discard-path CGI configure option and converted
  to INI configuration. Removed via
  06f43b30c1.

- HAVE_ERRMSG_H
  Removed via fd1578c196.

- HAVE_REGCOMP
  Used for regcomp function.

- HAVE_RINT
  Used for rint function.

- NEED_ISBLANK
  Windows ctype.h once didn't have C99 isblank() function. Cannot be
  found on current Windows systems anymore, neither was used in PHP at
  least since PHP 4.0.

- PHP_URL_FOPEN
  Removed via cae27179ce.

- REGEX
  Not used in current code.

- HSREGEX
  Not used in current code.

- USE_CONFIG_FILE
  Symbol was once defined by the --with-config-file-path configure
  option.
2024-03-07 20:27:10 +01:00
Jorg Sowa
9c4beac8d3 Remove inet_aton
This removes the deprecated inet_aton and its Windows implementation.
The inet_aton can be replaced with platform agnostic inet_pton.

Closes GH-13479
2024-02-23 23:16:43 +01:00
Peter Kokot
bd365149f2
Find and link math library as needed with AC_SEARCH_LIBS (#13481)
On some systems (Haiku) the math library is part of the C library and it
doesn't need to be explicitly prepended to LIBS. The redundant HAVE_LIBM
symbol defined by the AC_CHECK_LIB has been removed.
2024-02-23 20:48:10 +01:00
Jorg Adam Sowa
e630aacf79
Remove HAVE_INET_PTON (#13410) 2024-02-21 00:43:56 +00:00
Ilija Tovilo
631bc81607
Implement stackless internal function calls
Co-authored-by: Dmitry Stogov <dmitry@zend.com>

Closes GH-12461
2024-02-06 17:42:28 +01:00
Peter Kokot
b3bdc23656 Remove unused Makefile variables FIBER_ASSEMBLER and FIBER_ASM_ARCH
In Windows build system these were replaced with common PHP_ASSEMBLER
and FIBER_ASM_ABI when adjusting for the arm64.

Closes GH-13263
2024-01-30 09:50:22 +01:00
Peter Kokot
a651ae86aa
Sync Zend/Optimizer headers installation (#13201)
On *nix installation there is zend_dfg.h installed as part of the bug
fix #81136, but it wasn't synced with Windows yet. This now syncs Zend
headers on both builds.
2024-01-20 15:05:06 +01:00
Peter Kokot
c774a8d401
Add bison -Wall flag to Windows build (#13098)
Following the d7d3a1c66e, this adds bison
flag -Wall also to Windows build system.

Flag has been added via 2127a37b83.
2024-01-11 11:05:00 +01:00
Peter Kokot
bb1109d9f1 Remove unused HAVE_INET_NTOP
The inet_ntop() is always required and present via
931a8b0739.
2024-01-04 20:48:17 +01:00
Peter Kokot
84022db846
Remove unused SIZEOF_SHORT (#13034) 2023-12-30 00:58:47 +01:00
Ilija Tovilo
2efe366af6
Add zend_worklist.h to PHP_INSTALL_HEADERS (#12571)
Fixes GH-12565
2023-10-30 19:37:27 +01:00
Christian Clauss
886bf820c9
[skip ci] Fix typos discovered by codespell (#12228) 2023-09-18 11:07:17 +01:00
Peter Kokot
8df8550321
Remove unneeded zend_language_parser.h patch (#12178)
This was cleaned in 4cbffd89d9 and
patching the Zend/zend_language_parser.h file to include zend.h is not
needed anymore.

Autotools build system part has been similarly cleaned via
32cdd330f3
2023-09-14 08:04:21 +02:00
Pierrick Charron
ad2ac6f05f
Prepare for PHP 8.4 2023-08-29 15:25:46 -04:00
Peter Kokot
9911ab7142
Remove unused ZEND_STACK_GROWS_DOWNWARDS constant (#11762) 2023-07-22 19:39:42 +02:00
Arnaud Le Blanc
d0731934b7
Expose time spent collecting cycles in gc_status() (#11523) 2023-07-16 12:34:28 +02:00
Niels Dossche
0b2e6bc2b0 Cache d_type in directory entry 2023-07-07 18:02:32 +02:00
Max Kellermann
413844d626
Zend/zend_types.h: deprecate zend_bool, zend_intptr_t, zend_uintptr_t (#10597)
These types are standard C99.

For compatibility with out-of-tree extensions, keep the typedefs
in main/php.h.
2023-02-18 19:31:28 +00:00
Jakub Zelenka
d5ce616bb3
Merge branch 'PHP-8.2' 2023-02-17 16:40:14 +00:00
Jakub Zelenka
a7d57e242e
Merge branch 'PHP-8.1' into PHP-8.2 2023-02-17 16:38:53 +00:00
Daniel Black
2b3fa5edac
zend win32 RE2C header files to Make targets and generated_files
like zend_ini_parser.h, list zend_ini_scanner_defs.h and
zend_language_scanner_defs.h.

Add all these files to generated_files so they don't get missed.
2023-02-17 16:37:14 +00:00
Arnaud Le Blanc
a11c8a3039
Limit stack size (#9104) 2022-12-16 17:44:26 +01:00
Jorg Adam Sowa
77ee92a50c
Remove unnecessary usage of CONST_CS
Closes GH-9685.
2022-11-28 17:12:07 +01:00
Christoph M. Becker
dbf211de40
Merge branch 'PHP-8.2'
* PHP-8.2:
  Avoid undefined behavior in Windows ftok(3) emulation
2022-11-18 14:38:03 +01:00
Christoph M. Becker
5e307d0cab
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Avoid undefined behavior in Windows ftok(3) emulation
2022-11-18 14:37:45 +01:00
Christoph M. Becker
2d94ee5f20
Avoid undefined behavior in Windows ftok(3) emulation
`.nFileIndexHigh` is a unsigned 32bit number.  Casting that to `__int64`
and shifting left by 32bits triggers undefined behavior if the most
significant bit of `.nFileIndexHigh` is set.  We could avoid that by
casting to `(__uint64)`, but in that case the whole clause doesn't have
an effect anymore, so we drop it altogether.

Closes GH-9958.
2022-11-18 14:37:00 +01:00
Christoph M. Becker
5a5037f223
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-9890: OpenSSL legacy providers not available on Windows
2022-11-14 12:43:29 +01:00
Christoph M. Becker
9aa86e619d
Fix GH-9890: OpenSSL legacy providers not available on Windows
We need to copy the provider DLLs from the dependency package to the
PHP distribution.

Closes GH-9894.
2022-11-14 12:42:37 +01:00
Pierrick Charron
327c95237c
Prepare for PHP 8.3 2022-08-30 11:17:15 -04:00
Christoph M. Becker
c643cbf388
Support test-ini also for phpize builds
Automatically generating and using test INI files is supported for
in-tree build (`buildconf`) for a long time, and this can make sense
for phpize builds too, especially when the build extension is a zend
extension, so it can be properly loaded.

Thus we make `--enable-test-ini` and `--with-test-ini-ext-exclude`
available for phpize, but default to false for full BC.

Closes GH-8787.
2022-08-26 14:25:10 +02:00
dixyes
279a297172
Windows arm64 build system support
Closes GH-9116.
2022-08-09 16:22:14 +02:00
dixyes
02881a76a8
Port win32/codepage.c codes for windows arm64
Closes GH-7702.
2022-07-21 14:02:25 +02:00
David Carlier
bfe6f9e66a Introduction of timing attack safe bcmp implementation.
Nothing new but to refactor usage b/w hash and password
extensions but using volatile pointers to be a bit safer,
allowing to expand its usage eventually.
2022-06-20 16:30:30 +01:00
Christoph M. Becker
8aa7e203ed
Escape problematic characters in CREDITS files
On Windows, the contents of the CREDITS files are passed to rc.exe via
the command line.  To avoid undesired behavior, we need to escape some
characters, most notably `<` (which is sometimes used in CREDITS to
enclose mail addresses), which otherwise is interpreted as redirection
operator, resulting in the hard to understand "The system cannot find
the file specified."

Even more dangerous is not properly escaping percent signs, which makes
it possible for a malicious CREDITS file to inject the values of
environment variables of the build system into the generated binaries.
This is particularly bad, because as of Windows Vista, the comments can
no longer be inspected via explorer.exe, although the binaries still
contain these comments.

We also cater to double-quotes, which need to be escaped as `\"\"` in
this context.

Closes GH-8767.
2022-06-20 16:02:49 +02:00
Christoph M. Becker
7d6821a98a
Remove superfluous snapshot_build_exclusions
These configuration options have been removed, so there is no need to
still cater to them.

Closes GH-8792.
2022-06-18 14:26:51 +02:00
Christoph M. Becker
9e9141f712
Use HTTPS URLs in resource files
Although it is unlikely that anybody ever sees these URLs, since they
are not shown in the file property sheet, it's overdue to switch to
HTTPS.
2022-06-15 17:56:14 +02:00
Levi Morrison
280fd680c8
Make vm_interrupt and timed_out atomic (#8327)
This is done by adding a new zend_atomic_bool type. The type
definition is only available for compiler alignment and size info; it
should be treated as opaque and only the zend_atomic_bool_* family of
functions should be used.

Note that directly using atomic_bool is complicated. All C++ compilers
stdlibs that I checked typedef atomic_bool to std::atomic<bool>, which
can't be used in an extern "C" section, and there's at least one usage
of this in core, and probably more outside of it.

So, instead use platform specific functions, preferring compiler
intrinsics.
2022-06-01 09:43:25 -06:00
Calvin Buckley
2920a26636
Quote when adding to connection string in (PDO_)ODBC
Because the UID= and PWD= values are appended to the SQLDriverConnect
case when credentials are passed, we have to append them to the string
in case users are relying on this behaviour. However, they must be
quoted, or the arguments will be invalid (or possibly more injected).
This means users had to quote arguments or append credentials to the raw
connection string themselves.

It seems that ODBC quoting rules are consistent enough (and that
Microsoft trusts them enough to encode into the .NET BCL) that we can
actually check if the string is already quoted (in case a user is
already quoting because of this not being fixed), and if not, apply the
appropriate ODBC quoting rules.

This is because the code exists in main/, and are shared between
both ODBC extensions, so it doesn't make sense for it to only exist
in one or the other. There may be a better spot for it.

Closes GH-8307.
2022-05-27 16:56:44 +02:00
George Peter Banyard
9f06bb3bb6
Drop remaining usage of u_char in favour of standard C99 uint8_t (#8611)
Plus minor drive-by fixes
2022-05-23 21:57:31 +01:00
George Peter Banyard
de41d6b0ce
I shall never touch anything Windows related 2022-05-22 16:46:33 +01:00
George Peter Banyard
892927eb14
Use proper function prototypes in win32/glob.c
This just confused the hell out of me
2022-05-22 16:34:26 +01:00
George Peter Banyard
265c88b9e7
Don't initialise pointers to zend_stat_t 2022-05-22 16:13:44 +01:00
George Peter Banyard
2ecd46f48f
Initialise zend_stat_t to fix MSAN build 2022-05-22 16:06:27 +01:00
Christoph M. Becker
81d1a1b47b
Update bug tracker links
The new php-src bugtracker is on Github.

Closes GH-8277.
2022-05-12 14:55:11 +02:00