Commit Graph

14796 Commits

Author SHA1 Message Date
Derick Rethans
972383fda4 Revert "Partial fixed bug #79649 (Altering disable_functions from module init corrupts memory)"
This reverts commit a297c09da5.
2020-07-09 09:50:25 +01:00
Nikita Popov
77acc8a069 Fixed bug #79793
Make sure the string key is not released while throwing the
undefined index warning.
2020-07-07 16:29:48 +02:00
Nikita Popov
62bec0e083 Fixed bug #79784
The fix here is essentially the same as for bug #78598, just for
the undefined variable notice, rather than the undefined index one.
2020-07-07 14:22:58 +02:00
Nikita Popov
220880ad2d Fixed bug #78598
When performing an RW modification of an array offset, the undefined
offset warning may call an error handler / OB callback, which may
destroy the array we're supposed to change. Detect this by temporarily
incrementing the reference count. If we find that the array has been
modified/destroyed in the meantime, we do nothing -- the execution
model here would be that the modification has happened on the destroyed
version of the array.
2020-07-07 12:13:58 +02:00
Nikita Popov
48a247178e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79792
2020-07-07 11:59:40 +02:00
Nikita Popov
64931fd3c4 Fixed bug #79792
We need to remove the iterators even if the array is empty (we
will not create one if the first place, but the array may become
empty after the fact).
2020-07-07 11:58:25 +02:00
Nikita Popov
6a9d934b2c Fixed bug #79779
ASSIGN_OBJ_REF was not handling in zend_wrong_string_offset.
2020-07-07 10:27:22 +02:00
Nikita Popov
d9b4974cbc Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79778
2020-07-07 10:20:11 +02:00
Nikita Popov
b765f96f5f Fixed bug #79778
In the interest of avoiding side-effects during dumping, I'm
replacing the value with a <constant ast> string instead of
performing an update constant operation.
2020-07-07 10:19:39 +02:00
Nikita Popov
971e5c5186 Fixed bug #79783
Make sure we don't drop the by-reference check when passing the
result of a VM builtin function.
2020-07-07 09:56:14 +02:00
Nikita Popov
d1be10dd7e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Remove bogus generator iterator dtor
2020-06-30 17:33:33 +02:00
Nikita Popov
187a72d563 Remove bogus generator iterator dtor
Fixes a use-after-free encountered in Symfony's SecurityBundle.
I don't have a reproducer for this, and believe the issue can only
occur if we leak an iterator (the leak is a separate issue).

We should not free the generator iterator here, because we do not
own it. The code that fetched the iterator is responsible for
releasing it. In the rare case where we do hit this code-path,
we cause a use-after-free.
2020-06-30 17:32:42 +02:00
Nikita Popov
0fa70b3cde Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix leak when setting cyclic previous exception in finally
2020-06-30 12:25:29 +02:00
Nikita Popov
fc6f53d426 Fix leak when setting cyclic previous exception in finally
A curious exception handling pattern found in Symfony's HttpClient.
2020-06-30 12:24:32 +02:00
Nikita Popov
c5caa05171 Fixed bug #79740 2020-06-26 10:31:55 +02:00
Christoph M. Becker
91982bad63 7.3 is now 7.3.21-dev 2020-06-23 10:29:42 +02:00
Nikita Popov
3dfa25833f Don't use ternary in ini default
We use sizeof() on ini defaults, so this isn't safe. I can't reproduce
the failures locally, but I expect this to fix the asan jobs.
2020-06-18 10:15:53 +02:00
Nikita Popov
9b3e57921f Suppress zend signals check in two readline tests
Installing a callback handler may cause libedit to register new
signals during the request.
2020-06-17 17:13:01 +02:00
Xinchen Hui
a297c09da5 Partial fixed bug #79649 (Altering disable_functions from module init corrupts memory)
In module startup stage, we should not initiliaze
EG(modified_ini_directives) as it use zend MM, the zend MM will be
restart at the end of modules startup stage,

by say "partial", because this issue still exists if altering ZEND_USER
inis, we should add a zend_ini_deactive at the end of modules startup
stage, but it brings some new cost, and I think no one would do things
like that
2020-06-10 11:16:42 +08:00
Nikita Popov
2447fd9f84 Fixed bug #79683
Reset fake_scope during __toString() call.

I'll check if we can solve this more globally in master, by
resetting fake_scope in zend_call_function.
2020-06-09 15:51:05 +02:00
Nikita Popov
df2db7fcea Fixed bug #79657
Throwing an exception should count as an initialization for this
purpose.
2020-06-08 11:31:28 +02:00
Christoph M. Becker
5e38a1b352 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79668: get_defined_functions(true) may miss functions
2020-06-04 09:00:01 +02:00
Christoph M. Becker
b8e7b30b47 Fix #79668: get_defined_functions(true) may miss functions
Instead of some brittle and unefficient string matching, we can just
check for the function handler.
2020-06-04 08:45:27 +02:00
Christoph M. Becker
8483a21f29 Fix several mostly Windows related phpdbg bugs
* Properly initialize PHPDBG_G(watch_tmp)

  Otherwise that may cause segfaults in ZTS builds.

* Deactivate potentially remaining watchpoints after REPL

  Otherwise the memory could still be protected, resulting in segfaults
  during shutdown.

* NULL zend_handlers_table after freeing

  As of commit 4130fe4[1], the `zend_handlers_table` is explicitly
  freed in the `zend_vm_dtor()`.  Since phpdbg (and maybe some other
  SAPIs) may restart the engine afterwards, we have to make sure that
  the table is also NULLed.

* Only set context option if there is a context

  In other words, we must not follow the null pointer.

* Cater to file handles without attached console

  File handles do not necessarily have an attached console (for
  instance, pipes do not), in which case `GetConsoleScreenBufferInfo()`
  fails.  In this case we set a default value (`40`) for lines like on
  other systems.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=4130fe437a5db7ead1444d3748bd0fbad9829cb2>
2020-05-26 17:45:25 +02:00
Christoph M. Becker
879004dae3 Fix #79595: zend_init_fpu() alters FPU precision
On startup, PHP deliberately changes the floating point control word to
enforce binary64 format for the calculations for best consistency
across platforms.  However, this is unnessary for x86_64 architectures,
because in this case SSE instructions are used by default, and there is
no good reason to pass `-mfpmath=i387` or such.

Therefore, we can skip the modification, which has the benefit that
system libraries are free to work in the mode of their liking.
2020-05-26 17:19:54 +02:00
Nikita Popov
4a08ca1294 Respect typed references in catch assignment
I decided to null out EG(exception) early here, which means only
the exception from the dtor / ref assign is preserved, and the
previous exception is not chained in. This is more robust, and
I don't think this situation is common enough to be bothered about
the precise behavior.
2020-05-26 14:59:40 +02:00
Nikita Popov
314ab47e55 Fix zend_assign_to_typed_ref() implementation
There was some confusion going on here regarding the original
value vs the copied value.

I've dropped the needs_copy variable, because this code is not
inlined, so it would always be true anyway.

What we need to do is perform a move-assignment of the copied
value (in which case we don't care about performing the assignment
before destroying garbage), and destroying the original value
for the VAR/TMP cases. This is a bit complicated by the fact that
references are passed in via a separate ref variable, so we can't
just ptr_dtor the original variable.
2020-05-26 14:42:27 +02:00
Christoph M. Becker
c249f593ef 7.3.20 will be next 2020-05-26 10:53:22 +02:00
Nikita Popov
10eb842a64 Revert "Fix #79595: zend_init_fpu() alters FPU precision"
This reverts commit 88dfc475c5.
2020-05-22 16:57:14 +02:00
Christoph M. Becker
88dfc475c5 Fix #79595: zend_init_fpu() alters FPU precision
On startup, PHP deliberately changes the floating point control word to
enforce binary64 format for the calculations for best consistency
across platforms.  However, this is unnessary when compiling under
`__SSE__`, because in this case the x87 instructions are not used.
Therefore, we can skip the modification, which has the benefit that
system libraries are free to work in the mode of their liking.
2020-05-22 15:46:13 +02:00
Nikita Popov
4f47ba99f0 Fix bug #79603, by retrying on RTD key collision
This is a non-intrusive fix for 7.4, still trying to find a good
solution for master.

Closes GH-5597.
2020-05-20 11:22:50 +02:00
Nikita Popov
8819d247c6 Don't require rc=1 for function static variables
If file cache only is used, then static_variables_ptr may point
to an immutable static_variables HT, which we do not want to
destroy here.
2020-05-20 11:12:18 +02:00
Nikita Popov
d87b0685b5 Fixed bug #79600
Missed unsetting of DO_INIT in one case.
2020-05-15 11:04:40 +02:00
Xinchen Hui
ccd41e0833 Fixed bug #97599 (coredump in set_error_handler) 2020-05-15 15:36:00 +08:00
Nikita Popov
3978d3a957 Canonicalize bison error during ini parsing
Bison 3.6 seems to use "end of file" rather than "$end" for this.
Force the same on older bison versions to be consistent.
2020-05-14 14:15:56 +02:00
Nikita Popov
21a9ad910b Fixed bug #79548
When duplicating user functions with static variables, make sure
that we init a new map ptr slot for the static variables.
2020-05-04 16:27:45 +02:00
Xinchen Hui
5d3b7ac92c Merge branch 'PHP-7.4' of git.php.net:/php-src into PHP-7.4
* 'PHP-7.4' of git.php.net:/php-src:
  Fix #79532: sizeof off_t can be wrong
  Make 045.phpt busy wait
  Revert "Fix #79065: DOM classes do not expose properties to Reflection"
  Bump version
  Fix #79065: DOM classes do not expose properties to Reflection
  Fix #79470: PHP incompatible with 3rd party file system on demand
2020-04-29 18:58:48 +08:00
Xinchen Hui
8555c2bff0 Fixed bug #79536 (zend_clear_exception prevent exception's destructor to be called). 2020-04-29 18:58:28 +08:00
Christoph M. Becker
6998cc5029 Bump version 2020-04-28 09:10:50 +02:00
Christoph M. Becker
a2ed731fa5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79470: PHP incompatible with 3rd party file system on demand
2020-04-27 09:31:38 +02:00
Christoph M. Becker
29968d8f99 Fix #79470: PHP incompatible with 3rd party file system on demand
We add support for Activision HSM (`IO_REPARSE_TAG_ACTIVISION_HSM`) and
VFS for Git (`IO_REPARSE_TAG_PROJFS`).  The latter fixes bug #78784.
2020-04-27 09:30:57 +02:00
Christoph M. Becker
3151676f52 Fix #79514: Memory leaks while including unexistent file
We have to destroy (un-opened) ZEND_HANDLE_FILENAMEs.
2020-04-24 18:14:53 +02:00
Dmitry Stogov
b2376be81d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  zend_timeout() may access EX(opline)
2020-04-17 14:56:01 +03:00
Dmitry Stogov
d31ccb5fc8 zend_timeout() may access EX(opline) 2020-04-17 14:55:14 +03:00
Nikita Popov
58e6a0a602 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79477
2020-04-15 11:21:42 +02:00
Nikita Popov
79a36ff7f3 Fixed bug #79477
Make sure to deindirect properties when creating array.
2020-04-15 11:21:05 +02:00
Nikita Popov
823a956855 Fixed bug #78434
The DO_INIT flag, which will skip the first resume on a primed
generator, should always be set when starting to yield from a
new generator, not only when the yield from happens during priming.
2020-04-09 10:33:11 +02:00
Nikita Popov
b3c7ab66fb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79434
2020-04-02 16:34:21 +02:00
Nikita Popov
cf68bc413b Fixed bug #79434 2020-04-02 16:34:03 +02:00
Christoph M. Becker
33226c3a17 Next is 7.3.18 2020-03-31 10:22:55 +02:00