vs(tr)pprintf is now implemented in Zend on top of
printf_to_smart_str(int), which is provided as a utility function.
This allows us to efficiently printf to the end of a smart string.
It's annoying that in Zend you have to use zend_strpprintf instead
of strpprintf, while in PHP you have to use strpprintf instead of
zend_strpprintf.
Make zend_s(tr)pprintf always available and keep s(tr)pprintf as
macro aliases.
* PHP-7.0:
Disabled PHP call tracing by default (it makes significant overhead). This may be enabled again using envirionment variable USE_ZEND_DTRACE=1.
This mainly involves a separate abstraction layer for elements (e.g. $a->b) and watchpoints (on pointer of the Bucket for example).
Also better comparison handling (value backup vs. page dumps).
It is not yet finished (there are sometimes false positives announced and names not yet perfect), but the functionality is working and not crashing as far as I have tested.
Future scope is also relative watchpoints, e.g. "w $this->val expression()" which does not have the symbol tables as basis, but the value (in this example: return value of expression()) as basis.
Since long the default PHP charset is UTF-8, however the Windows part is
out of step with this important point. The current implementation in PHP
doesn't technically permit to handle UTF-8 filepath and several other
things. Till now, only the ANSI compatible APIs are being used. Here is more
about it
https://msdn.microsoft.com/en-us/library/windows/desktop/dd317752%28v=vs.85%29.aspx
The patch fixes not only issues with multibyte filenames under
incompatible codepages, but indirectly also issues with some other multibyte
encodings like BIG5, Shift-JIS, etc. by providing a clean way to access
filenames in UTF-8. Below is a small list of issues from the bug tracker,
that are getting fixed:
https://bugs.php.net/63401https://bugs.php.net/41199https://bugs.php.net/50203https://bugs.php.net/71509https://bugs.php.net/64699https://bugs.php.net/64506https://bugs.php.net/30195https://bugs.php.net/65358https://bugs.php.net/61315https://bugs.php.net/70943https://bugs.php.net/70903https://bugs.php.net/63593https://bugs.php.net/54977https://bugs.php.net/54028https://bugs.php.net/43148https://bugs.php.net/30730https://bugs.php.net/33350https://bugs.php.net/35300https://bugs.php.net/46990https://bugs.php.net/61309https://bugs.php.net/69333https://bugs.php.net/45517https://bugs.php.net/70551https://bugs.php.net/50197https://bugs.php.net/72200https://bugs.php.net/37672
Yet more related tickets can for sure be found - on bugs.php.net, Stackoverflow
and Github. Some of the bugs are pretty recent, some descend to early
2000th, but the user comments in there last even till today. Just for example,
bug #30195 was opened in 2004, the latest comment in there was made in 2014. It
is certain, that these bugs descend not only to pure PHP use cases, but get also
redirected from the popular PHP based projects. Given the modern systems (and
those supported by PHP) are always based on NTFS, there is no excuse to keep
these issues unresolved.
The internalization approach on Windows is in many ways different from
UNIX and Linux, while it supports and is based on Unicode. It depends on the
current system code page, APIs used and exact kind how the binary was compiled
The locale doesn't affect the way Unicode or ANSI API work. PHP in particular
is being compiled without _UNICODE defined and this is conditioned by the
way we handle strings. Here is more about it
https://msdn.microsoft.com/en-us/library/tsbaswba.aspx
However, with any system code page ANSI functions automatically convert
paths to UTF-16. Paths in some encodings incompatible with the
current system code page, won't work correctly with ANSI APIs. PHP
till now only uses the ANSI Windows APIs.
For example, on a system with the current code page 1252, the paths
in cp1252 are supported and transparently converted to UTF-16 by the
ANSI functions. Once one wants to handle a filepath encoded with cp932 on
that particular system, an ANSI or a POSIX compatible function used in
PHP will produce an erroneous result. When trying to convert that cp932 path
to UTF-8 and passing to the ANSI functions, an ANSI function would
likely interpret the UTF-8 string as some string in the current code page and
create a filepath that represents every single byte of the UTF-8 string.
These behaviors are not only broken but also disregard the documented
INI settings.
This patch solves the issies with the multibyte paths on Windows by
intelligently enforcing the usage of the Unicode aware APIs. For
functions expect Unicode (fe CreateFileW, FindFirstFileW, etc.), arguments
will be converted to UTF-16 wide chars. For functions returning Unicode
aware data (fe GetCurrentDirectoryW, etc.), resulting wide string is
converted back to char's depending on the current PHP charset settings,
either to the current ANSI codepage (this is the behavior prior to this patch)
or to UTF-8 (the default behavior).
In a particular case, users might have to explicitly set
internal_encoding or default_charset, if filenames in ANSI codepage are
necessary. Current tests show no regressions and witness that this will be an
exotic case, the current default UTF-8 encoding is compatible with any
supported system. The dependency libraries are long switching to Unicode APIs,
so some tests were also added for extensions not directly related to streams.
At large, the patch brings over 150 related tests into the core. Those target
and was run on various environments with European, Asian, etc. codepages.
General PHP frameworks was tested and showed no regressions.
The impact on the current C code base is low, the most places affected
are the Windows only places in the three files tsrm_win32.c, zend_virtual_cwd.c
and plain_wrapper.c. The actual implementation of the most of the wide
char supporting functionality is in win32/ioutil.* and win32/codepage.*,
several low level functionsare extended in place to avoid reimplementation for
now. No performance impact was sighted. As previously mentioned, the ANSI APIs
used prior the patch perform Unicode conversions internally. Using the
Unicode APIs directly while doing custom conversions just retains the status
quo. The ways to optimize it are open (fe. by implementing caching for the
strings converted to wide variants).
The long path implementation is user transparent. If a path exceeds the
length of _MAX_PATH, it'll be automatically prefixed with \\?\. The MAXPATHLEN
is set to 2048 bytes.
Appreciation to Pierre Joye, Matt Ficken, @algo13 and others for tips, ideas
and testing.
Thanks.
Instead of directly writing to stdout. This allows doing a print_r
into a string, without using output buffering.
The motivation for this is bug #67467: print_r() in return mode
will still dump the string to stdout (causing a potential information
leak) if a fatal error occurs.
* PHP-7.0:
Fixed bug #71443 (Segfault using built-in webserver with intl using symfony)
Fix memory leak with not freeing OpenSSL errors
check for NULL and avoid crashes
Update libmagic.patch for PHP-5.6
Fixed bug #7143 (finfo throws notice for specific python file)
Instead add a loop_var member to brk_cont_element. Now that
brk_cont is compile-time the distinction is no longer necessary.
Also drops brk_cont.start, check the loop_var op_type instead.
Added Throwable interface that exceptions must
implement in order to be thrown. BaseException
was removed, EngineException renamed to
Error, and TypeException and ParseException
renamed to TypeError and ParseError. Exception
and Error no longer extend a common base
class, rather they both implement the Throwable
interface.
Renamed compiler_context to oparray_context. Introduced per-file
file_context. Moved import tables into the file_context.
context_stack no longer exists, instead keeping backups of contexts
on C stack. Same for file contexts.
TODO: Move more things out of CG into file_context. There should be
a number of other things that we should not try to reuse in nested
compilations.
Cycle leaks are currently not reported, because this needs further
work.
The last GC run has been moved to run earlier (before the object
store free), so that array cycles that hold references to objects
don't show up as leaks. Fingers crossed that this doesn't adversely
affect anything else.
Instead of using the array apply count on the debug_info array, use
the object apply count for recursion detection when dumping. This
handles recursion in a more generic way and does not require each
debug_info handler to deal with this.
This allows returning a temporary debug_info array, instead of
having to store it in the object (thus delaying destruction of the
values).
Switch SPL debug_info handlers to use a temporary array.
Introduces a ZEND_PARSE_PARAMS_THROW flag for zpp, which forces to
report FAILURE errors using a TypeException instead of a Warning,
like it would happen in strict mode.
Adds a zend_parse_parameters_throw() convenience function, which
invokes zpp with this flag.
Converts all cases I could identify, where we currently have
throwing zpp usage in constructors and replaces them with this API.
Error handling is still replaced to EH_THROW in some cases to handle
other, domain-specific errors in constructors.
Primarily to avoid getting fatal errors from token_get_all().
Implemented using a magic E_ERROR token, which the lexer emits to
force a parser failure.
See https://wiki.php.net/rfc/expectations
Squashed commit of the following:
commit 3f3651a787
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Mar 2 11:56:33 2015 +0300
opcode 137 is used for ZEND_OP_DATA and con't be reused for ZEND_ASSERT_CHECK
commit ca8ecabf2a
Merge: 24328ac9dac923
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Mar 2 10:49:23 2015 +0300
Merge branch 'master' into assert
* master:
Update NEWS
Fixed bug #69139 (Crash in gc_zval_possible_root on unserialize)
windows only test
Align entries format
Align entries format for 5.6.7
Align entries format for 5.5.23
Bump header year
Fixed bug #69144 (strtr not replacing with partly matching replace pairs)
Fixed test?
Revert mktime()/gmmktime()'s arginfo
Update NEWS
Fixed bug #69141 Missing arguments in reflection info for some builtin functions
Add NEWS entry
Remove useless date warning
Fix ARG_INFO for levenshtein
Fix ARG_INFO for levenshtein
fix dir separator in tests
Update NEWS
Fixed bug #69085 (SoapClient's __call() type confusion through unserialize()).
commit 24328ac03f
Merge: 021fd941cdee9a
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Feb 27 15:57:13 2015 +0300
Merge branch 'master' into assert
* master:
Fixed C++ support
Fixed bug #69115 crash in mail
Reorder
Update NEWs
Fixed bug #69121 (Segfault in get_current_user when script owner is not in passwd with ZTS build)
Update News
Fixed bug #69125 (Array numeric string as key)
fix bug#68942's patch
Fixed ability to build unspecialized executor
Fixed bug #69124 (method name could not be used when by ref)
Fixed a bug that header value is not terminated by '\0' when accessed through getenv().
Fixed a bug that header value is not terminated by '\0' when accessed through getenv().
commit 021fd94ed1
Merge: 49963ebace1f82
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Feb 26 11:26:03 2015 +0300
Merge branch 'master' into assert
* master: (59 commits)
Improved ASSIGN_DIM handler
Don't inline slow path
Revert a part committted by mistake
Fixed compilation warnings
Fixed a bug that header value is not terminated by '\0' when accessed through getenv().
better name
Improve fix for #69038
Update NEWs
Fixed bug #69108 ("Segmentation fault" when (de)serializing SplObjectStorage)
Added specialized versions of DO_FCALL handler: DO_ICALL - for internal functions DO_UCALL - for user functions DO_FCALL_BY_NAME - plain, most probably user, funcstions (not methods)
Use cache_slot offsets instead of indexes (simplify run-time instructions)
Split INIT_FCALL_BY_NAME inti INIT_FCALL_BY_NAME(CONST+STRING) and INIT_DYNAMIC_CALL(CONST-STRING|TMPVAR|CV)
Support list($a, $b) = $a
Avoid unnecassary check
Make zend_array_destroy() to free the corresponding zend_array
Eliminate check on the fast path
Make current() and key() receive argument by value.
Use Firebird default home folder, replace Interbase with Firebird
Updated NEWS
updated NEWS
...
Conflicts:
Zend/zend_vm_execute.h
Zend/zend_vm_opcodes.c
Zend/zend_vm_opcodes.h
commit 49963ebf9d
Merge: 07b1f926b77959
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Feb 19 11:13:08 2015 +0300
Merge branch 'master' into assert
* master:
Implemented AST pretty-printer
update NEWS to match the actual stuff in 5.6.6
update NEWS to match the actual stuff in 5.5.22
update NEWS(add missing entry for the enchant fix, and reorder the entries a bit)
fix typo in bug#
update NEWS
fix email format
update NEWS
update 5.6.6 release date in NEWS
Fix bug #69033 (Request may get env. variables from previous requests if PHP works as FastCGI)
BFN
fix test
fix test
fix test
Fixed bug #65593 (Segfault when calling ob_start from output buffering callback)
Updated NEWS
add CVE
5.4.39 next
Fix associativity to match Perl
Blast off to space.
Conflicts:
Zend/zend_ast.c
commit 07b1f92ed6
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Feb 18 23:06:32 2015 +0300
fixed pretty-printer (support for "elseif")
commit 5a976c8d85
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Feb 18 19:50:08 2015 +0300
Fixed vaeious ptetty-printer issues
commit 69491e8e8e
Merge: 84731573ddc246
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Feb 18 10:18:32 2015 +0300
Merge branch 'master' into assert
* master:
Set PHP_JSON_VERSION to 1.4.0
Remove unnecessary resource checks in openssl ext
JSON is now maintained
commit 8473157fbb
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Feb 18 10:17:26 2015 +0300
Fixed typo and white spaces
commit 96de5ffc8d
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Feb 18 00:28:39 2015 +0300
Fixed assert() in namesapaces
commit 5eba069c28
Merge: 4a2d9c0d428bf2
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Feb 17 22:45:55 2015 +0300
Merge branch 'master' into assert
* master: (25 commits)
improve debugability in TS debug builds
More UPGRADING, in particular on foreach
Fixed bug #69038 (switch(SOMECONSTANT) misbehaves) for master
Replace var is introduced
abstain from using xmlCleanupParser
fix TS build
Fix bug #68942 (Use after free vulnerability in unserialize() with DateTimeZone)
update news
Fix bug #68942 (Use after free vulnerability in unserialize() with DateTimeZone)
Port for for bug #68552
Fix bug #68942 (Use after free vulnerability in unserialize() with DateTimeZone)
Update NEWS
Fixed bug #69038 (switch(SOMECONSTANT) misbehaves)
- BFN
Don't read the local php.ini when Generating Phar When building phar shared, you can end up loading a previous phar.so that isn't compatible with the php cli being used to generate Phar here.
- Fixed bug #67827 (broken detection of system crypt sha256/sha512 support)
Delete json outdated package.xml
made ZEND_TSRMLS_CACHE_* macros look like function calls
- Fix merge
- Fixed bug #67427 (SoapServer cannot handle large messages) patch by: brandt at docoloc dot de
...
commit 4a2d9c0953
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Feb 17 22:45:10 2015 +0300
Implemented AST pretty-printer to capture expression passed to assert()
commit 7a059b66d5
Merge: 9973df73892eba
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Feb 16 18:42:28 2015 +0300
Merge branch 'expect' of github.com:krakjoe/php-src into assert
* 'expect' of github.com:krakjoe/php-src:
import expect
Conflicts:
Zend/zend_compile.c
Zend/zend_execute_API.c
Zend/zend_globals.h
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
Zend/zend_vm_opcodes.c
Zend/zend_vm_opcodes.h
ext/opcache/Optimizer/block_pass.c
ext/opcache/Optimizer/pass1_5.c
ext/standard/assert.c
ext/standard/tests/assert/assert_error3.phpt
commit 3892eba2bf
Author: krakjoe <joe.watkins@live.co.uk>
Date: Sun Feb 2 12:49:35 2014 +0000
import expect
Now each HashTable is also zend_array, so it's refcounted and may be a subject for Copy on Write
zend_array_dup() was changed to allocate and return HashTable, instead of taking preallocated HashTable as argument.
That's the same as in the previous commit. In the TS mode the tsrm
cache pointer might be unavailable or point to a wrong thread, so
the exact globals passed should be freed.
* origin/master:
updated NEWS
PowerPC64 support for add and sub with overflow check
PowerPC64 support for operators with overflow check
Fixed bug #68583 Crash in timeout thread
Reduced size of zend_op on 64-bit systems.
Make ZEND_INIT_FCALL keep predcalculted size of necessary stack space in opline->op1.num to avoid its recalculation on each execution.
Removed unused variables
Improved array_merge() and array_replace() (1-st array may be added using simple procedure).
Replaced zendi_convert_to_long() with _zval_get_long_func()
Moved zend_is_true() from zend_execute.h/zend_execute_API.c into zend_operators.h/zend_operators.c. Splited the most expensive part of inline i_zend_is_true() into a separate zend_object_is_true(). Replaced zendi_convert_to_long() with cals to zend_is_true().
Revert "Save one xor instr"
Save one xor instr
Conflicts:
Zend/zend_execute_API.c
This replaces the GUI element used for execution timeout handling
on Windows. Instead a timer queue technique is used, which is indeed
a thread pool. A timer queue timer is a lightweight object handled
but that thread pool and the timer thread spends most of the time
sleeping and waiting for an alert.
Please note also that this introduces neither binary nor source
breach. The custom timeout thread functions are deleted, however
they was not exported throug DLL, so couldn't be used by any
external code. As well they couldn't be used anywhere in the core
except in executor api, because those custom timeout thread
functions they used to operate on static variables which would
be overwritten (and that would blow).
So instead a relatively modern technique is used for the timeout
handling. It's still not perfect because the executor still has to
check EX(timed_out). This can be a topic for an improvement in
master. But brobably can be tricky as currently it seems to be not
possible to signal an individual thread. Also note another issue
that static variables aren't thread safe, but the current timer
implementation is.
* origin/master: (214 commits)
fix datatype mismatch warnings
fix datatype mismatches
fix datatype mismatches
fix datatype mismatches
fix datatype mismatch warnings
fix datatype mismatch warnings
fix datatype mismatch warnings
fix datatype mismatch warning
fix datatype mismatches
fix datatype mismatch warnings
Re-add phpdbg to travis
Added some NEWS
Make xml valid (missing space between attrs)
Fix info classes file name in xml
Add note about <eval> tag for errors in xml.md
Name the tag <eval> if the error id during ev cmd
Do not print out xml as PHP print...
Fix output to wrong function
Fixed parameter order on %.*s
Too much copypaste...
...
* origin/master:
We can't eliminate FETCH_CONSTANT opcodes for constants represented by AST.
Ensure __LINE__ is always accurate
Fix incdec of referenced properties
Fix ::jsonSerialize() failure message
Fix invalid zend_string_frees in reflection
Remove retval member in spl_dllist
DLL export several APIs needed for phpdbg
More fixes for nodelist array access - testing for null property read - no zval copying if the type is already long - memory fix for master
* origin/master: (40 commits)
int to size_t where the underlaying API supports it
use php_socket_t instead of int
fix signed/unsigned mismatch warning
fix compilation warning
Improved specialisation $this variable accessed through IS_UNUSED operand must be IS_OBJECT, so we don't have to check for its type or perform dereference.
Add notes about get_class_entry/get_class_name to UPGRADING
Fix casts in GD
Drop redundant casting code from ext/filter
update NEWS
update NEWS
update NEWS
update NEWS
Added note to UPGRADING regarding 64-bit support in pack()/unpack()
pack(): Use SIZEOF_ZEND_LONG instead of SIZEOF_LONG
Add 64 bit formats to pack() and unpack()
Help to CPU branch predictor
Removed unused EG(orig_error_reporting)
Update get_class_name semantics
Remove Z_OBJ_CLASS_NAME_P
Improved VM stack primitives for fast paths. Slow paths are not inlined anymore.
...
* get_class_name is now only used for displaying the class name
in debugging functions like var_dump, print_r, etc. It is no
longer used in get_class() etc.
* As it is no longer used in get_parent_class() the parent
argument is now gone. This also fixes incorrect parent classes
being reported in COM.
* get_class_name is now always required (previously some places
made it optional and some required it) and is also required
to return a non-NULL value.
* Remove zend_get_object_classname. This also fixes a number of
potential leaks due to incorrect usage of this function.
* origin/master:
bring back the correct php_version.h
fix the empty_strings SAPI shutdown leak in TS build
Use fastcall calling convention for heap functions
fix leaking the empty_string in TS builds
remove successive assignment
still the NTS variant is somewhat different as it needs
zend_new_interned_string_int because the normal callbacks might
be not initialized, but at least no leaks anymore and some more
structure
* origin/master: (42 commits)
Add tests verifying calls work inside echo, concatenation and array access
Updated NEWS and UPGRADING
Fix $this CV init for include/eval
Fix dynamic calls to static methods with fci->object
Fix $arr =& $arr[0]
Add UPGRADING stubs for a number of recent changes
Regenerate tokenizer data
Fix unused variable warning
Remove <% and <script language="php"> tags
zend_uint -> uint32_t
Fix nesting for *non*-compile-time-resolveable functions See a1a4ba9511 (commitcomment-7414223)
Add tests for calls to nested, *non*-compile-time-resolveable functions See a1a4ba9511 (commitcomment-7414362)
Make list of opcodes used for nesting calculation consistent with `zend_do_convert_call_user_func()` in Zend/zend_compile.c
Rewrite code to use ZEND_VM_JMP() instead of repeated ZEND_VM_INC_OPCODE() calls
QA: Simplify code to find matching ZEND_DO_FCALL_BY_NAME CG(context).nested_calls is stored inside the initializer's result.num and inside the finalizer's op2.num, by comparing these we don't need to count manually, and are thus safer from future expansion with specialized opcodes e.g.
Fix expected fatal error, now is catchable fatal
Adjust expected fatal error message Now also includes "on [TYPE]" after merge from master
Check for memory leaks when not using return value
Adjust expected fatal error message Now also includes "on [TYPE]" after merge from master
Add tests with arrays as parameters
...
As per https://wiki.php.net/rfc/remove_alternative_php_tags.
Removes:
* <% opening tag
* %> closing tag
* <%= short opening tag
* /<script\s+language\s*=\s*(php|"php"|'php')\s*>/i opening tag
* /</script>/i closing tag
* asp_tags ini directive
TLS is already used in TSRM, the way exporting the tsrm cache through
a thread local variable is not portable. Additionally, the current
patch suffers from bugs which are hard to find, but prevent it to
be worky with apache. What is done here is mainly uses the idea
from the RFC patch, but
- __thread variable is removed
- offset math and declarations are removed
- extra macros and definitions are removed
What is done merely is
- use an inline function to access the tsrm cache. The function uses
the portable tsrm_tls_get macro which is cheap
- all the TSRM_* macros are set to placebo. Thus this opens the way
remove them later
Except that, the logic is old. TSRMLS_FETCH will have to be done once
per thread, then tsrm_get_ls_cache() can be used. Things seeming to be
worky are cli, cli server and apache. I also tried to enable bz2
shared and it has worked out of the box. The change is yet minimal
diffing to the current master bus is a worky start, IMHO. Though will
have to recheck the other previously done SAPIs - embed and cgi.
The offsets can be added to the tsrm_resource_type struct, then
it'll not be needed to declare them in the userspace. Even the
"done" member type can be changed to int16 or smaller, then adding
the offset as int16 will not change the struct size. As well on the
todo might be removing the hashed storage, thread_id != thread_id and
linked list logic in favour of the explicit TLS operations.
* origin/master: (31 commits)
Fixed C++ incompatibility
update the certificate used for the test, as it expired recently
Fixed immutable arrays support
Fix counting of "R:" references in serialize()
Remove dead code
Test use($this) being an error
Move list() condition into assign_znode
typo
NEWS
Fix bug #68074 Allow to use system cipher list instead of hardcoded value
Avoid double checks
the order of the blocks should be Core, then exts in alphabetical order
add missing NEWS entry for the phpdbg compilation fix
add NEWS entry for #68088
Make QM_ASSIGN, JMP_SET and CAST return IS_TMP_VAR.
Removed useless helper
Drop unused result argument
Fix ct binding for cuf/cufa functions
Fix detection of write to built-in function for references
Test use of string names with \ prefix
...
- windows only, on linux gcc would cause a warning that the function returns,
as no noreturn functions are used
- ZEND_NORETURN works on windows as well now, using __declspec(noreturn),
which is useful for the other cases
- one more function call will be needed, which is not critical for the
error reporting
- the way is open to enable the same for gcc as soon as it's not causing a warning
* PHP-5.6:
update NEWS
Only destruct if EG(active) in zend_shutdown(). (bug #65463, #66036)
Fix typo from commit 32314f6b6
Fix destruction order in zend_shutdown (bug #65463, #66036)
Conflicts:
Zend/zend_compile.h
Zend/zend_execute_API.c
* PHP-5.5:
update NEWS
Only destruct if EG(active) in zend_shutdown(). (bug #65463, #66036)
Fix typo from commit 32314f6b6
Fix destruction order in zend_shutdown (bug #65463, #66036)
* PHP-5.4:
update NEWS
Only destruct if EG(active) in zend_shutdown(). (bug #65463, #66036)
Fix typo from commit 32314f6b6
Fix destruction order in zend_shutdown (bug #65463, #66036)
* pull-request/770:
Only destruct if EG(active) in zend_shutdown(). (bug #65463, #66036)
Fix typo from commit 32314f6b6
Fix destruction order in zend_shutdown (bug #65463, #66036)
Now one common stack to handle both, which stores znodes instead of
full oplines (foreach copy stack) or switch entries (switch cond
stack).
Also removed EG(start_op) while at it.
As far as I can discern these are leftovers of the interactive
shell implementation that was used before PHP 5.4. Now the readline
ext makes use of normal eval calls for this.
So, dropping these until there is evidence to the contrary, as they
currently wouldn't work anyway.
If Apache or a similar SAPI receives a signal during PHP processing
it calls zend_shutdown() without calling shutdown_executor().
#65463: If a module like Gearman or Memcached is loaded,
in the unfixed version it is unloaded by zend_destroy_modules() before the
CG(CLASS_TABLE) is destructed. When CG(CLASS_TABLE) is destructed,
any pointers to methods (specifically around destruction) in the unloaded
module's .so are now dangling and the process segfaults.
#66036: Any subclasses of an internal class like ArrayObject need
to be destructed in order: subclass first and then the internal class. In the
unfixed version zend_shutdown() clears the CG(CLASS_TABLE) from the head
of the list onwards, so internal classes are destructed first and user-defined
classes last. Internal classes are alloc/deallocated with malloc/free while
user-defined classes with emalloc/efree. If there's shared data between them
then efree() could be called instead of free() leading to a seg-fault.
This issue was originally hacked around in zend_make_printable_zval.
I've now moved the overridden __toString() handling into the SXE
cast_object handler, so everything invoking that handler
(zend_make_printable_zval, convert_to_string, zval_get_string,
and various other more obscure usages) see the same behavior.