1
0
mirror of https://github.com/php/php-src.git synced 2026-04-11 10:03:18 +02:00
Commit Graph

16599 Commits

Author SHA1 Message Date
George Peter Banyard
2f1d0f2bc3 Throw directly instead of replacing error handler in ext/date (#6954) 2021-05-07 11:10:39 +01:00
KsaR
01b3fc03c3 Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Nikita Popov
13467bdcc0 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #81015
2021-05-06 10:47:22 +02:00
Aaron Piotrowski
779fe8e43a Check current_execute_data instead of flags in fiber destructor
Checking EG(current_exectue_data) throws into the previous fiber instead of triggering a fatal error during shutdown. A fatal error is triggered only if the throwing destroyed fiber was resumed from {main}.
2021-05-05 10:48:30 -05:00
Nikita Popov
fb374f56a7 Rethrow exceptions in fiber destructor
We need to make sure that HANDLE_EXCEPTION is set when the fiber
throws during destruction.

Fixes oss-fuzz #33875.
2021-05-05 12:49:47 +02:00
Nikita Popov
4411026217 Close generator already in dtor phase
In the added test case, the Closure ends up being freed before
the generator during GC.

This patch closes the generator (and thus releases the held
closure / execute_data) already during dtor_obj, which will avoid
ordering issues in free_obj. dtor_obj is not always called, but
if it isn't, then we also won't run GC and will free_obj in
reverse construction order.

Fixes oss-fuzz #33947.
2021-05-04 16:59:59 +02:00
Nikita Popov
2aac616071 Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't treat failed assignment as initialization
2021-05-04 14:46:52 +02:00
Nikita Popov
398cfb982e Don't treat failed assignment as initialization
Only reset the uninitialized property flag once the type check
has succeeded. Previously the property was treated as unset rather
than uninitialized after a failed assignment.

Noticed this edge-case while working on accessors...
2021-05-04 14:46:04 +02:00
Aaron Piotrowski
810fb59f66 Improve fiber backtraces
The start/resume/throw execute_data is now attached as the prev_execute_data to the bottom frame of the fiber stack when the fiber is running.
2021-04-30 12:17:50 -05:00
Aaron Piotrowski
f3465e6740 Minor fiber fixes
Assert error is fatal when calling zend_error_suspend_fiber.

Added missing static.

Removed .S extension from output of configure.
2021-04-30 10:08:01 -05:00
Nikita Popov
b9040852b3 Slightly clarify zend_wrong_parameter_error() implementation
This function may be called with Z_ERROR_FAILURE, and should do
nothing in that case. Otherwise, all cases need to be explicitly
handled.
2021-04-30 10:38:34 +02:00
Nikita Popov
feab479884 Also destroy classes in reverse order with ZTS 2021-04-30 09:58:29 +02:00
Aaron Piotrowski
4166653298 Fix exception thrown during fiber destruction
Previously an exception thrown during fiber destruction resulted in a fatal error, but that exception should be able to be caught (unless we’ve entered shutdown, then still use a fatal error so the error is not hidden).
2021-04-30 00:26:47 -05:00
Nikita Popov
79d237c8b6 Remove some unnecessary exception type checks
These types are enforced by typed properties now.
2021-04-29 21:23:58 +02:00
Nikita Popov
79071d5e3e Don't duplicate internal prop info (#6929)
Userland property infos are no longer duplicated since PHP 7.4, when we
stopped setting SHADOW flags on inherited private properties. Stop duplicating
internal property infos as well.

This requires switching class destruction to work in reverse order, as child
classes may be reusing structures from parent classes, and as such should be
destroyed first.
2021-04-29 20:31:24 +02:00
Nikita Popov
dd86987b2c Replay warnings during inheritance (#6928)
Since 3e6b447979 it is again possible to have
warnings (deprecations) during inheritance, and more such functionality is
likely in the future. This is a problem, because such warnings will only be
shown on the first request if the opcache inheritance cache is used. This
currently causes test failures in --repeat builds.

Fix this by uplifting the error recording functionality from opcache to Zend,
and then using it to persist a warning trace in the inheritance cache, which
can then be used to replay the warnings on subsequent executions.
2021-04-29 16:37:53 +02:00
Nikita Popov
e8e7c04a3a Use common struct to store error information
This is needed by both fibers and opcache (and GH-6903 also uses it),
so make it a common structure that can be used by any functionality
storing warnings/errors.
2021-04-29 11:50:54 +02:00
Nikita Popov
81d1c1bc78 Remove accidentally added flag 2021-04-29 09:46:47 +02:00
Nikita Popov
9a1da9f61f Don't use separate static variables in inherited methods
RFC: https://wiki.php.net/rfc/static_variable_inheritance

Closes GH-6719.
2021-04-28 17:08:50 +02:00
Nikita Popov
3e6b447979 Partially deprecate Serializable
If Serializable is implemented, require that __serialize() and
__unserialize() are implemented as well, else issue a deprecation
warning.

Also deprecate use of PDO::FETCH_SERIALIZE.

RFC: https://wiki.php.net/rfc/phase_out_serializable

Closes GH-6494.
2021-04-28 16:55:14 +02:00
Nikita Popov
fd1d5ec2b4 Add ZEND_CLASS_CONST_FLAGS() macro
And drop Z_ACCESS_FLAGS(). We no longer store *only* access flags
in these.
2021-04-28 14:51:54 +02:00
Nikita Popov
88ce1c71b5 Look up func info using function name rather than lcname of call
As we already have the called zend_function here, let's use the
name directly, rather than using the lcname of the call. This means
that aliases would be handled correctly automatically.
2021-04-28 12:13:05 +02:00
Nikita Popov
97c6d6605e Remove FR/FX macros
Functions returning by-reference are generally a lost cause, we
won't be able to provide useful information for them.
2021-04-28 12:13:01 +02:00
Nikita Popov
d0610898f6 Remove UNKNOWN_INFO func info entries
There's no need to explicitly list that we don't know anything
about a function -- that's the default state.
2021-04-28 11:45:34 +02:00
Nikita Popov
bfa8b49196 Merge branch 'PHP-8.0'
* PHP-8.0:
  Remove incorrect func info for array_reduce() and pos()
2021-04-28 11:41:59 +02:00
Nikita Popov
08afe9891c Merge branch 'PHP-8.0'
* PHP-8.0:
  filter_var_array() may return array_of_ref
2021-04-28 11:28:06 +02:00
Nikita Popov
b5778ce1b7 Merge branch 'PHP-8.0'
* PHP-8.0:
  fetch_assoc may return array_key_long
2021-04-28 11:20:55 +02:00
Nikita Popov
e8ef923dd6 Merge branch 'PHP-8.0'
* PHP-8.0:
  Remove assert_options() return value info
2021-04-28 11:06:54 +02:00
Nikita Popov
bd5419abd6 Merge branch 'PHP-8.0'
* PHP-8.0:
  password_get_info() may return array_of_null
2021-04-28 10:55:57 +02:00
Nikita Popov
3ddab31842 Merge branch 'PHP-8.0'
* PHP-8.0:
  getdate() may return array_key_long
2021-04-28 10:48:04 +02:00
Nikita Popov
cb1d1138f6 Merge branch 'PHP-8.0'
* PHP-8.0:
  pg_connect() may return rcn
2021-04-28 10:38:07 +02:00
Nikita Popov
2ffab441c8 Fix pgsql func info
Some functions can now return a value with refcount > 1.
2021-04-28 10:14:29 +02:00
Aaron Piotrowski
c276c16b66 Implement Fibers
RFC: https://wiki.php.net/rfc/fibers

Closes GH-6875.
2021-04-26 11:07:06 -05:00
George Peter Banyard
7372a3e117 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix Bug #80972: Memory exhaustion on invalid string offset
2021-04-26 13:22:37 +01:00
George Peter Banyard
418fcd22e8 Fix Bug #80972: Memory exhaustion on invalid string offset
Closes GH-6890
2021-04-26 13:21:40 +01:00
Nikita Popov
0c3f70730b Slightly clean up error_reporting() implementation
zend_long_to_str() cannot throw, and we don't really need the
do/while block either.
2021-04-23 17:11:35 +02:00
Nikita Popov
78e1f190fc Export zend_error_zstr_at()
This is the formerly static function zend_error_impl(), which is
the core error handling implementation.
2021-04-23 11:29:55 +02:00
Nikita Popov
a1c6ee2164 Convert error filename to zend_string
Error handling functions/callbacks now accept the error filename
as a zend_string* instead of a const char*.
2021-04-23 11:05:14 +02:00
Máté Kocsis
30a082cb16 Make some exception properties typed
Closes GH-6891
2021-04-22 10:22:50 +02:00
Máté Kocsis
533a6bcb29 Get rid of private final methods (#6892) 2021-04-21 10:08:25 +02:00
George Peter Banyard
d24cf1a417 Introduce zend_error_unchecked()
To be used with custom formats like %H as otherwise the compiler complains about unknown formats
2021-04-20 19:41:36 +01:00
Nikita Popov
c4a749c932 Remove php includes from sccp.c 2021-04-20 12:26:12 +02:00
Nikita Popov
b82242a88d Remove unnecessary php.h includes from Zend/
The Zend/ directory really shouldn't be including php headers.
These particular includes are plain unnecessary.
2021-04-20 12:21:45 +02:00
Nikita Popov
9799cf989c Reset property table for disabled classes
To avoid retaining behavior about property visibility or types.
2021-04-20 10:35:10 +02:00
Dmitry Stogov
08dafda123 Fixed use-after-free introduced by ca49e53670 2021-04-19 18:16:14 +03:00
Christoph M. Becker
c8a966a9ae Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80960: opendir() warning wrong info when failed on Windows
2021-04-19 16:18:03 +02:00
Christoph M. Becker
cb262cd974 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80960: opendir() warning wrong info when failed on Windows
2021-04-19 16:17:01 +02:00
Christoph M. Becker
ea3c992bff Fix #80960: opendir() warning wrong info when failed on Windows
Firstly, we must not forget to set appropriate error codes for "manual"
checks in `virtual_file_ex()`.

Secondly, we must not call `php_error_docref2()` for warnings regarding
unary functions; thus, we introduce `php_win32_docref1_from_error()`.

Closes GH-6872.
2021-04-19 16:12:22 +02:00
George Peter Banyard
dcdc5d9069 Drop -Wno-implicit-fallthrough compiler flag
And add it back to ext/date, ext/hash, and ext/opcache
2021-04-19 13:59:18 +01:00
Matt Brown
6cd0b48cac Implement never return type
The never type can be used to indicate that a function never
returns, for example because it always unwinds.

RFC: https://wiki.php.net/rfc/noreturn_type

Closes GH-6761.
2021-04-19 11:27:29 +02:00