Nikita Popov [Thu, 16 Mar 2017 16:02:11 +0000 (17:02 +0100)]
Optimize DJ spanning tree back-edge check
Instead of walking the DJ spanning tree upwards, record entry and
exit times during the DFS and use these to determine whether CJ
edges are sp-back edges.
Nikita Popov [Thu, 16 Mar 2017 15:49:36 +0000 (16:49 +0100)]
Sort blocks in loop identification
The previous implementation was doing O(blocks*levels) iterations,
which for a linear-ish domtree is O(blocks^2). Avoid this by sorting
the blocks by decreasing level upfront.
Anatol Belski [Wed, 15 Mar 2017 11:34:36 +0000 (12:34 +0100)]
Use zend_test shared for tests
The snapshot build enables everything it could find. The test run will
load all the shared exts as well, until defined otherwise. So no needs
for an extra action.
Sara Golemon [Tue, 14 Mar 2017 17:30:49 +0000 (10:30 -0700)]
Minor optimizations to array_keys()/array_values()
array_values():
When the input is an empty array or a packed array with no gaps,
return the original array.
array_keys():
When the input is an empty array, return the original array.
When the input is a packed array with no holes
(and no search key specified), populate the return with
a simple range(0, count($input) - 1)
Joe Watkins [Sun, 12 Mar 2017 19:00:06 +0000 (19:00 +0000)]
Merge branch 'pull-request/2414'
* pull-request/2414:
zend-test extension to house code that is required for testing internal APIs, but that we would not want to expose for regular builds
Remi Collet [Fri, 10 Mar 2017 10:52:26 +0000 (11:52 +0100)]
Constify to void build warning for C++ ext. [-Wwrite-strings]
Example (with v8js):
/builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS/v8js_class.cc: In function 'void v8js_execute_script(zval*, v8js_script*, long int, long int, long int, zval**)':
/usr/include/php/Zend/zend.h:204:57: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
#define zend_bailout() _zend_bailout(__FILE__, __LINE__)
^
/builddir/build/BUILD/php-pecl-v8js-1.3.4/NTS/v8js_class.cc:633:3: note: in expansion of macro 'zend_bailout'
zend_bailout();
^~~~~~~~~~~~
Sara Golemon [Wed, 8 Mar 2017 18:00:59 +0000 (10:00 -0800)]
Try fallback on IPv4 ANYADDR when IPv6 ANYADDR fails
https://bugs.php.net/bug.php?id=74166
A host system with no/limited IPv6 support will fail at binding
the IPv6 ANYADDR address (::) as the address family is unsupported.
Deal with this by handling failure to implicitly bind to ::
as a soft failure, falling back to 0.0.0.0.
If binding to :: failed for some other reason (e.g. port in use)
then binding to 0.0.0.0 will likely fail as well, but we'll
get appropriate warnings for that.
Sara Golemon [Tue, 7 Mar 2017 19:27:46 +0000 (11:27 -0800)]
Detect invalid port in xp_socket parse ip address
For historical reasons, fsockopen() accepts the port and hostname
separately: fsockopen('127.0.0.1', 80)
However, with the introdcution of stream transports in PHP 4.3,
it became possible to include the port in the hostname specifier:
fsockopen('127.0.0.1:80')
Or more formally: fsockopen('tcp://127.0.0.1:80')
Confusing results when these two forms are combined, however.
fsockopen('127.0.0.1:80', 443) results in fsockopen() attempting
to connect to '127.0.0.1:80:443' which any reasonable stack would
consider invalid.
Unfortunately, PHP parses the address looking for the first colon
(with special handling for IPv6, don't worry) and calls atoi()
from there. atoi() in turn, simply stops parsing at the first
non-numeric character and returns the value so far.
The end result is that the explicitly supplied port is treated
as ignored garbage, rather than producing an error.
This diff replaces atoi() with strtol() and inspects the
stop character. If additional "garbage" of any kind is found,
it fails and returns an error.