Anatol Belski [Sun, 12 Feb 2017 21:13:21 +0000 (22:13 +0100)]
The d_name member of struct dirent should be a pointer
Rework for 60950702, so then any encoding is supported. The path
segment length is measured in wchar_t size, whereby the number
of wchar_t is 255+\0. This means, in the actual encoding, the path
segment size can become (255*<bytes per glyph>)+\0 bytes in worst
case. It is still valid, as all the FS API uses wide chars
internally.
Derick Rethans [Sun, 12 Feb 2017 20:17:01 +0000 (20:17 +0000)]
Upgrade timelib to 2017.01
This fixes:
- Fixed bug #72719 (Relative datetime format ignores weekday on sundays only).
- Fixed bug #73294 (DateTime wrong when date string is negative).
- Fixed bug #73489 (wrong timestamp when call setTimeZone multi times with UTC
offset).
- Fixed bug #73858 (first/last day of' flag is not being reset).
- Fixed bug #73942 ($date->modify('Friday this week') doesn't return a Friday
if $date is a Sunday).
- Fixed bug #74057 (wrong day when using "this week" in strtotime).
Anatol Belski [Sun, 12 Feb 2017 16:15:50 +0000 (17:15 +0100)]
refactor php_win32_get_random_bytes(), take 2
As in previous variant, locking is removed and the initialization
is done only once at process start. The CNG API turns out to be
faster, also the initialization is less resources hungry. The
initialization part could need to be improved, if too much startup
failures are sighted in the real world usage. Though that would mean
having locking back.
The usage of CNG was already pointed out and requested in several
reports, with the further refactoring it appears to make sense and
simplify things a backward compatible way.
Looks like this change is unstable. If same CSP is use but multiple processers,
the initialization failures are possible. Thus, CryptAcquireContext in
every process, even if it won't be used at all, is not sensible. This
might actually motivate to look for better CSP APIs.
Dmitry Stogov [Fri, 10 Feb 2017 07:31:43 +0000 (10:31 +0300)]
Fixed bug #74053 (Corrupted class entries on shutdown when a destructor spawns another object). (jim at commercebyte dot com)
Merge branch 'master' of github.com:commercebyte/php-src
* 'master' of github.com:commercebyte/php-src:
Added EG(flags) - executor global flags EG_FLAGS_IN_SHUTDOWN - is set when PHP is in shutdown state
newly added zend_object_store.no_reuse is redefined as a global zend_object_store_no_reuse, to avoid alignment issues
Alignment fix, as per @nikic
The test scripts bug64720.phpt and bug68652.phpt were relying on the buggy behavior, when PHP returns "Undefined static property" error due to class entry corruption. With my fix for bug 74053, both tests return no errors now, I corrected the EXPECTF accordingly
Bug Fix: Corrupted class entries on shutdown when a destructor spawns another object (C) 2017 CommerceByte Consulting
Jim Zubov [Tue, 7 Feb 2017 14:19:16 +0000 (09:19 -0500)]
The test scripts bug64720.phpt and bug68652.phpt were relying on the buggy behavior,
when PHP returns "Undefined static property" error due to class entry corruption.
With my fix for bug 74053, both tests return no errors now, I corrected the EXPECTF accordingly
[Anybody please advice if I'm wrong?]
Also created bug74053.phpt, for the code I mentioned in the bug description
Jim Zubov [Mon, 6 Feb 2017 23:05:34 +0000 (18:05 -0500)]
Bug Fix:
Corrupted class entries on shutdown when a destructor spawns another object
(C) 2017 CommerceByte Consulting
When zend_objects_store_call_destructors() is called from the shutdown sequence -
it's calling the dtor's for remaining objects one by one in sequence of object handles.
If the dtor spawns one or more objects, and the new objects happen to reuse the old handles -
their dtor's are not called in this cycle.
The dtor's are called later on, when zend_deactivete() kicks in, and the static property lists in the class entries are freed.
This causes "Undefined static property" errors, and/or SIGSEGV.
Solution:
zend_object_store.no_reuse field is added
Set to 0 on initialization, set to 1 on the shutdown sequence.
zend_objects_store_put(zend_object *) checks the no_reuse flag, and never reuses the old handle slots if set.
This way, the dtor's for newly spawned objects are guaranteed to be called in the zend_objects_store_call_destructors() loop.