1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 16:52:18 +01:00
Commit Graph

343 Commits

Author SHA1 Message Date
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
George Peter Banyard
fa8d9b1183 Improve type declarations for Zend APIs
Voidification of Zend API which always succeeded
Use bool argument types instead of int for boolean arguments
Use bool return type for functions which return true/false (1/0)
Use zend_result return type for functions which return SUCCESS/FAILURE as they don't follow normal boolean semantics

Closes GH-6002
2020-08-28 15:41:27 +02:00
Máté Kocsis
3df306de94 Promote warnings to exceptions in ext/pcntl
Closes GH-6004
2020-08-25 13:02:13 +02:00
Nikita Popov
8fbc618a3c Fix invalid zpp calls in pcntl_get/setpriority 2020-08-13 16:46:02 +02:00
Nikita Popov
217d05b18e Check permissions in pcntl_unshare_03.phpt 2020-08-10 15:59:02 +02:00
Máté Kocsis
7aacc705d0 Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
Máté Kocsis
046cc5e4c2 Add another round of missing parameter types to stubs
Closes GH-5950
2020-08-07 16:48:45 +02:00
Nikita Popov
74b285d78c Merge branch 'PHP-7.4'
* PHP-7.4:
  Check ps -p availability in process title test
  Add privilege check in pcntl_unshare test
2020-08-05 18:18:51 +02:00
Nikita Popov
8fd79d3574 Add privilege check in pcntl_unshare test
Privileges for CLONE_NEWPID were not checked.
2020-08-05 18:18:06 +02:00
Nikita Popov
7575340427 Merge branch 'PHP-7.4'
* PHP-7.4:
  Check ps -p availability in proc_nice test
  Set AI_CANONNAME flag in socket_addrinfo test
  Add ipv6 skipif to test
  Improve privilege check in pcntl_setpriority() test
2020-08-05 12:12:24 +02:00
Nikita Popov
34e7d78df7 Improve privilege check in pcntl_setpriority() test
We need CAP_SYS_NICE privileges, which might not be available
just because we're running as root (Docker...)
2020-08-05 12:09:10 +02:00
Nikita Popov
fcfa0a46c3 Suppress warning in pcntl_unshare skipif 2020-08-05 10:39:45 +02:00
Nikita Popov
36a1197f12 Suppress warning in pcntl_unshare skipif 2020-08-05 09:46:07 +02:00
Máté Kocsis
bdacd2ae8f Add a few missing types to stubs 2020-08-01 23:55:08 +02:00
Max Semenik
2b5de6f839 Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Fabien Villepinte
0c6d06ecfa Replace EXPECTF when possible
Closes GH-5779
2020-06-29 21:31:44 +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
596561009c Fix some UNKNOWN default values
In ext/ffi, ext/intl, ext/mysqli, and ext/pcntl
2020-06-09 09:46:51 +02:00
George Peter Banyard
24de4274f3 Fix [-Wundef] warning in PCNTL extension 2020-05-20 14:01:10 +02:00
Alex Dowad
555489dd83 Honor script time limit when calling shutdown functions
A time limit can be set on PHP script execution via `set_time_limit` (or .ini file).
When the time limit is reached, the OS will notify PHP and `timed_out` and `vm_interrupt`
flags are set. While these flags are regularly checked when executing PHP code, once the
end of the script is reached, they are not checked while invoking shutdown functions
(registered via `register_shutdown_function`).

Of course, if the shutdown functions are implemented *in* PHP, then the interrupt flag
will be checked while the VM is running PHP bytecode and the timeout will take effect.
But if the shutdown functions are built-in (implemented in C), it will not.

Since the shutdown functions are invoked through `zend_call_function`, add a check of the
`vm_interrupt` flag there. Then, the script time limit will be respected when *entering*
each shutdown function. The fact still remains that if a shutdown function is built-in and
runs for a long time, script execution will not time out until it finishes and the
interpreter tries to invoke the next one.

Still, the behavior of scripts with execution time limits will be more consistent after
this patch. To make the execution time-out feature work even more precisely, it would
be necessary to scrutinize all the built-in functions and add checks of the `vm_interrupt`
flag in any which can run for a long time. That might not be worth the effort, though.

It should be mentioned that this patch does not solely affect shutdown functions, neither
does it solely allow for interruption of running code due to script execution timeout.
Anything else which causes `vm_interrupt` to be set, such as the PHP interpreter receiving
a signal, will take effect when exiting from an internal function. And not just internal
functions which are called because they were registered to run at shutdown; there are
other cases where a series of internal functions might run in the midst of a script. In
all such cases, it will be possible to interrupt the interpreter now.

Closes GH-5543.
2020-05-13 12:47:12 +02:00
Máté Kocsis
4815be44db Generate function entries from stubs
Converts ext/pcntl, ext/simplexml, ext/snmp, ext/soap, ext/sqlite3.
Closes GH-5421
2020-04-20 10:38:41 +02:00
Nikita Popov
fb718ccc7e Suppress SIG_ERR cast warnings
By casting to void*. I don't want to deal with this right now.
2020-04-15 11:01:12 +02:00
Máté Kocsis
3709e74b5e Store default parameter values of internal functions in arg info
Closes GH-5353. From now on, PHP will have reflection information
about default values of parameters of internal functions.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-04-08 18:37:51 +02:00
Máté Kocsis
a43bc33fb2 Annotate function aliases in stubs 2020-04-04 13:03:16 +02:00
Máté Kocsis
736b22dc0b Add stubs for aliases
Closes GH-5187
2020-02-18 21:10:36 +01:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Nikita Popov
6811222422 Eliminate uses of ZVAL_ZVAL and friends
Instead add RETURN_COPY(_VALUE) macros will the expected behavior.

RETURN_ZVAL doesn't make any sense since PHP 7, but has stuck
around, probably because the alternative was to write directly to
the return_value variable.
2020-01-20 10:34:17 +01:00
Máté Kocsis
0b4778c377 Fix #78880: Another bunch of spelling errors 2020-01-16 09:46:47 +01:00
Máté Kocsis
aadd3aaed9 Use RETURN_THROWS() in various places 2020-01-03 21:10:24 +01:00
Máté Kocsis
7b4a4d2ace Use RETURN_THROWS() after try_convert_to_string() 2020-01-03 17:04:06 +01:00
Máté Kocsis
345703724c Use RETURN_THROWS() during ZPP in most of the extensions
Except for some bigger ones: reflection, sodium, spl
2019-12-31 11:46:11 +01:00
Nikita Popov
d011f60eb1 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78402: pcntl_signal() misleading error message
2019-12-20 11:03:15 +01:00
Nikita Popov
5155097431 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78402: pcntl_signal() misleading error message
2019-12-20 11:02:57 +01:00
SATO Kentaro
cbb0efaeeb Fix #78402: pcntl_signal() misleading error message
An error message can be misleading when a handler
passed to pcntl_signal() is not callable.
2019-12-20 11:02:20 +01:00
Fabien Villepinte
f67b27fac6 Fix typo in pcntl_sigwaitinfo proto 2019-11-18 12:53:36 +01:00
Máté Kocsis
27e83d0fb8 Add union return types for function stubs 2019-11-11 14:54:55 +01:00
Máté Kocsis
9493893412 Cleanup return values when parameter parsing is unsuccessful 2019-10-30 16:05:20 +01:00
Nikita Popov
45deb01cc2 Merge branch 'PHP-7.4'
* PHP-7.4:
  Skip large ftruncate test if large files not supported
  Don't test "blocks" in lstat_stat_variation7.phpt
  Increase FD used in php://fd test
  Use posix_getuid() to check for root in pcntl_setpriority() test
2019-10-24 14:47:15 +02:00
Nikita Popov
a3469146d4 Use posix_getuid() to check for root in pcntl_setpriority() test
Using SUDO_USER doesn't seem to work on Travis ARM CI -- I guess
that sudo might be in use without the target being root.
2019-10-24 14:46:25 +02:00
Nikita Popov
2041c9abf5 Merge branch 'PHP-7.4' 2019-10-02 10:09:37 +02:00
Nikita Popov
e98e1f92c9 Allow SA_RESTART for SIGALRM
If no explicit restart_syscalls is passed, default to
restart_syscalls=0 for SIGALRM only, to reduce BC impact.
2019-10-02 10:09:17 +02:00
Gabriel Caruso
5d6e923d46 Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Craig Duncan
48e696319c Convert pcntl functions arginfo to php stubs 2019-09-20 11:15:22 +02:00
Nikita Popov
99ce142f6e Some pcntl cleanup
Fix some indentation issues and make sure zpp is used consistently.
2019-08-27 17:25:19 +02:00
Peter Kokot
cf197962e1 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix typo
  Simplify functions checks in m4
2019-07-17 03:55:04 +02:00
Peter Kokot
476339646c Simplify functions checks in m4
- AC_CHECK_FUNCS already automatically defines belonging HAVE_function
  symbols and executes given shell code.
2019-07-17 03:50:47 +02:00
Nikita Popov
93f41d2aec Merge branch 'PHP-7.4' 2019-07-03 11:03:41 +02:00
Nikita Popov
aff0b77d15 Skip pcntl_sigwaitinfo() test under asan/msan
This test often fails under asan/msan with a timeout for unknown
reasons.
2019-07-03 11:03:27 +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