mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-22 08:26:38 +00:00
Compare commits
233
Commits
php-7.1.1
...
PHP-7.0.17
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89a97812aa | ||
|
|
387ea8b983 | ||
|
|
b6616f7e9c | ||
|
|
e60263d269 | ||
|
|
511a4b0918 | ||
|
|
46a418f450 | ||
|
|
7ac1122ff5 | ||
|
|
c564924d31 | ||
|
|
008fb28eaf | ||
|
|
bbfa1b6419 | ||
|
|
eac8166bd4 | ||
|
|
9450e23b32 | ||
|
|
ff8a6b1232 | ||
|
|
cc10515056 | ||
|
|
e9873d9853 | ||
|
|
330a7b62c3 | ||
|
|
1d4eead995 | ||
|
|
015a80ef7b | ||
|
|
9eaf551c86 | ||
|
|
593a4d8fe9 | ||
|
|
bd7e5c1548 | ||
|
|
c836ad1c7e | ||
|
|
1623ef10c9 | ||
|
|
513582814b | ||
|
|
61e59db99d | ||
|
|
cf3ef36323 | ||
|
|
708973c9bd | ||
|
|
3b91ed112f | ||
|
|
5432d6f982 | ||
|
|
e79754dee3 | ||
|
|
89a5bd6750 | ||
|
|
3917350531 | ||
|
|
eb1373e509 | ||
|
|
f0519f4837 | ||
|
|
26fdebc63b | ||
|
|
01c1afa79f | ||
|
|
ee25eb0eae | ||
|
|
981c58705a | ||
|
|
7e5cf2aa19 | ||
|
|
9814be4bc2 | ||
|
|
db7c0badd4 | ||
|
|
185304a61e | ||
|
|
80c8d84af3 | ||
|
|
7a0adb4cd2 | ||
|
|
714d825b62 | ||
|
|
044dd30440 | ||
|
|
fd521a22f7 | ||
|
|
8a8aa67844 | ||
|
|
9ea0949f43 | ||
|
|
21d7878690 | ||
|
|
dcaf4da8a6 | ||
|
|
9ffc6ca62f | ||
|
|
6988d070ea | ||
|
|
4df993d89d | ||
|
|
75ad2b301a | ||
|
|
0b56ba51d0 | ||
|
|
25271feeb0 | ||
|
|
8faf5f979c | ||
|
|
dd9cf23457 | ||
|
|
acda2563ce | ||
|
|
a15bffd105 | ||
|
|
570a273807 | ||
|
|
6fc0ae638a | ||
|
|
1d7f8eb693 | ||
|
|
74c95fb3fb | ||
|
|
3446e3b749 | ||
|
|
69a2e4ece2 | ||
|
|
3f89b630b4 | ||
|
|
15e9aa1706 | ||
|
|
8dfa428ccd | ||
|
|
15404bda13 | ||
|
|
2cd0d8b711 | ||
|
|
ec43a11581 | ||
|
|
d9ca5d9637 | ||
|
|
0e21d8066b | ||
|
|
aa9742d80d | ||
|
|
163bb87897 | ||
|
|
5b5130c4ff | ||
|
|
536b3ca1e1 | ||
|
|
543141ae3b | ||
|
|
f39cabe610 | ||
|
|
bf0f53270f | ||
|
|
368958b3e4 | ||
|
|
dd227c2b23 | ||
|
|
62938bf088 | ||
|
|
4b1afc829c | ||
|
|
2b7e5468c9 | ||
|
|
df16579642 | ||
|
|
2fcf1259c6 | ||
|
|
a3d3f76827 | ||
|
|
f65ae82c55 | ||
|
|
a15c1990eb | ||
|
|
721a189742 | ||
|
|
737ee0661c | ||
|
|
c44efbbbb1 | ||
|
|
80a851b4dd | ||
|
|
d636467937 | ||
|
|
6f912f7c04 | ||
|
|
71efe9d8fd | ||
|
|
e56fe7e5e7 | ||
|
|
42d53f3bc0 | ||
|
|
f67d599a01 | ||
|
|
8da8756312 | ||
|
|
21ac79e94b | ||
|
|
2e3d68ed1b | ||
|
|
f81b7df618 | ||
|
|
cad2598fcb | ||
|
|
8c75dbc498 | ||
|
|
cf649f59cb | ||
|
|
8ba6d622e5 | ||
|
|
f9226f9bf3 | ||
|
|
fb8486f3bd | ||
|
|
280e9cb28d | ||
|
|
e7e96fe2e0 | ||
|
|
6af7753e36 | ||
|
|
6af22d0d3e | ||
|
|
a22f181736 | ||
|
|
e00c2f335c | ||
|
|
db894fa6aa | ||
|
|
3f960255f4 | ||
|
|
5d07438cb3 | ||
|
|
d2274b01cb | ||
|
|
f1b2afc9d9 | ||
|
|
b28c2e20ca | ||
|
|
e0ca519a8b | ||
|
|
6477bb724e | ||
|
|
50b38322b9 | ||
|
|
cc9893eb44 | ||
|
|
2c7909697a | ||
|
|
814966ad33 | ||
|
|
43d0f2abc5 | ||
|
|
0ab1af7d3e | ||
|
|
4f19bb7af6 | ||
|
|
60aff0bd30 | ||
|
|
fbf655afbd | ||
|
|
a4accc0e3e | ||
|
|
aaaef22db6 | ||
|
|
8e993b427c | ||
|
|
3500262b7d | ||
|
|
fd92b91188 | ||
|
|
04379bcb1d | ||
|
|
bd75f9e613 | ||
|
|
1ee1f79e27 | ||
|
|
ef42f49470 | ||
|
|
b2782c6dc5 | ||
|
|
51d487786c | ||
|
|
d9cd2876d9 | ||
|
|
13edec75a3 | ||
|
|
07340553a5 | ||
|
|
291e3f0762 | ||
|
|
ad9c552b12 | ||
|
|
15837bab8c | ||
|
|
6a9efa2d3e | ||
|
|
dcaed51ba0 | ||
|
|
1bdffee820 | ||
|
|
125ee6a68e | ||
|
|
69fbe3a9ad | ||
|
|
69058f35f8 | ||
|
|
14c72cc582 | ||
|
|
9ad3413190 | ||
|
|
7e49e8e797 | ||
|
|
28f2959b83 | ||
|
|
f1ad170a15 | ||
|
|
add4f43f0e | ||
|
|
ef7e5e0d69 | ||
|
|
4f1b24d974 | ||
|
|
63e08cbef7 | ||
|
|
b655f2d632 | ||
|
|
f7cb79431f | ||
|
|
8dd523a216 | ||
|
|
8c653c163a | ||
|
|
b8215c0817 | ||
|
|
47007455dc | ||
|
|
5b5483dc8e | ||
|
|
7f1247004e | ||
|
|
c75287dc85 | ||
|
|
eb02876e74 | ||
|
|
5df97b339e | ||
|
|
b36f4ac708 | ||
|
|
ec1b7b933d | ||
|
|
5146d9f8ac | ||
|
|
a46bbdda2e | ||
|
|
f346bd6ee6 | ||
|
|
2cb8950cc2 | ||
|
|
fc777296bf | ||
|
|
486fc0424a | ||
|
|
80a5ae4f53 | ||
|
|
49a0c166f3 | ||
|
|
d0279242ce | ||
|
|
b351ec8baf | ||
|
|
21f287915c | ||
|
|
574f7bc3d4 | ||
|
|
98c2cd4311 | ||
|
|
41c1d0291c | ||
|
|
3401f553b9 | ||
|
|
f98d8f6c15 | ||
|
|
4568618030 | ||
|
|
71e84e2c36 | ||
|
|
1516132167 | ||
|
|
826122fa8e | ||
|
|
e55e93a1e3 | ||
|
|
699ab98f9d | ||
|
|
62e9e1fecd | ||
|
|
9a0dac124e | ||
|
|
053b966134 | ||
|
|
ad08aa3956 | ||
|
|
ba0751a915 | ||
|
|
2d42423953 | ||
|
|
3a79f35fdc | ||
|
|
ff6b309c6f | ||
|
|
b0ff9ee688 | ||
|
|
6a03b43e5f | ||
|
|
a49aaf9ab0 | ||
|
|
12bbeaa45e | ||
|
|
8e39a27b76 | ||
|
|
4f1335cd4c | ||
|
|
49b2cbf763 | ||
|
|
81fb61f97c | ||
|
|
782b84c6d5 | ||
|
|
66b698c3cf | ||
|
|
db890956ec | ||
|
|
a7c444b939 | ||
|
|
a43a3798d3 | ||
|
|
3b14d7b84b | ||
|
|
372144508c | ||
|
|
183a34a5cf | ||
|
|
995ecffbb2 | ||
|
|
e7f23e164b | ||
|
|
c36ce04dd3 | ||
|
|
650e073f7a | ||
|
|
2edf296a92 | ||
|
|
a2c461d58a | ||
|
|
2ece3ea699 |
No files matched your search
@@ -29,22 +29,33 @@ document ____executor_globals
|
||||
end
|
||||
|
||||
define print_cvs
|
||||
____executor_globals
|
||||
set $p = $eg.current_execute_data.CVs
|
||||
set $c = $eg.current_execute_data.op_array.last_var
|
||||
set $v = $eg.current_execute_data.op_array.vars
|
||||
set $i = 0
|
||||
|
||||
printf "Compiled variables count: %d\n", $c
|
||||
while $i < $c
|
||||
printf "%d = %s\n", $i, $v[$i].name
|
||||
if $p[$i] != 0
|
||||
printzv *$p[$i]
|
||||
else
|
||||
printf "*uninitialized*\n"
|
||||
end
|
||||
set $i = $i + 1
|
||||
if $argc == 0
|
||||
____executor_globals
|
||||
set $cv_ex_ptr = $eg.current_execute_data
|
||||
else
|
||||
set $cv_ex_ptr = (zend_execute_data *)$arg0
|
||||
end
|
||||
set $cv_count = $cv_ex_ptr.func.op_array.last_var
|
||||
set $cv = $cv_ex_ptr.func.op_array.vars
|
||||
set $cv_idx = 0
|
||||
set $callFrameSize = (sizeof(zend_execute_data) + sizeof(zval) - 1) / sizeof(zval)
|
||||
|
||||
printf "Compiled variables count: %d\n\n", $cv_count
|
||||
while $cv_idx < $cv_count
|
||||
printf "[%d] '%s'\n", $cv_idx, $cv[$cv_idx].val
|
||||
set $zvalue = ((zval *) $cv_ex_ptr) + $callFrameSize + $cv_idx
|
||||
printzv $zvalue
|
||||
set $cv_idx = $cv_idx + 1
|
||||
end
|
||||
end
|
||||
|
||||
document print_cvs
|
||||
Prints the compiled variables and their values.
|
||||
If a zend_execute_data pointer is set this will print the compiled
|
||||
variables of that scope. If no parameter is used it will use
|
||||
current_execute_data for scope.
|
||||
|
||||
usage: print_cvs [zend_execute_data *]
|
||||
end
|
||||
|
||||
define dump_bt
|
||||
@@ -196,12 +207,17 @@ define ____printzv_contents
|
||||
____executor_globals
|
||||
set $handle = $zvalue->value.obj.handle
|
||||
set $handlers = $zvalue->value.obj.handlers
|
||||
set $zobj = $zvalue->value.obj
|
||||
set $cname = $zobj->ce->name->val
|
||||
set $zobj = $zvalue->value.obj
|
||||
set $cname = $zobj->ce->name->val
|
||||
printf "(%s) #%d", $cname, $handle
|
||||
if ! $arg1
|
||||
if $handlers->get_properties == &zend_std_get_properties
|
||||
set $ht = $zobj->properties
|
||||
if $zobj->properties
|
||||
set $ht = $zobj->properties
|
||||
else
|
||||
set $ht = &$zobj->ce->properties_info
|
||||
end
|
||||
printf "\nProperties "
|
||||
if $ht
|
||||
set $ind = $ind + 1
|
||||
____print_ht $ht 1
|
||||
@@ -212,7 +228,7 @@ define ____printzv_contents
|
||||
set $i = $i - 1
|
||||
end
|
||||
else
|
||||
echo "no properties found"
|
||||
echo "not found"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -455,9 +471,9 @@ define print_inh
|
||||
end
|
||||
|
||||
define print_pi
|
||||
set $pi = $arg0
|
||||
set $pi = (zend_property_info *)$arg0
|
||||
printf "[%p] {\n", $pi
|
||||
printf " h = %lu\n", $pi->h
|
||||
printf " ce = [%p] %s\n", $pi->ce, $pi->ce->name->val
|
||||
printf " flags = %d (", $pi->flags
|
||||
if $pi->flags & 0x100
|
||||
printf "ZEND_ACC_PUBLIC"
|
||||
@@ -476,16 +492,27 @@ define print_pi
|
||||
end
|
||||
printf ")\n"
|
||||
printf " name = "
|
||||
____print_str $pi->name $pi->name_length
|
||||
printf "\n}\n"
|
||||
print_zstr $pi->name
|
||||
printf "}\n"
|
||||
end
|
||||
|
||||
document print_pi
|
||||
Takes a pointer to an object's property and prints the property information
|
||||
usage: print_pi <ptr>
|
||||
end
|
||||
|
||||
define ____print_str
|
||||
set $tmp = 0
|
||||
set $str = $arg0
|
||||
if $argc > 2
|
||||
set $maxlen = $arg2
|
||||
else
|
||||
set $maxlen = 256
|
||||
end
|
||||
|
||||
printf "\""
|
||||
while $tmp < $arg1 && $tmp < 256
|
||||
if $str[$tmp] > 32 && $str[$tmp] < 127
|
||||
while $tmp < $arg1 && $tmp < $maxlen
|
||||
if $str[$tmp] > 31 && $str[$tmp] < 127
|
||||
printf "%c", $str[$tmp]
|
||||
else
|
||||
printf "\\%o", $str[$tmp]
|
||||
@@ -554,6 +581,23 @@ document printzops
|
||||
dump operands of the current opline
|
||||
end
|
||||
|
||||
define print_zstr
|
||||
set $zstr = (zend_string *)$arg0
|
||||
if $argc == 2
|
||||
set $maxlen = $arg1
|
||||
else
|
||||
set $maxlen = $zstr->len
|
||||
end
|
||||
printf "string(%d) ", $zstr->len
|
||||
____print_str $zstr->val $zstr->len $maxlen
|
||||
printf "\n"
|
||||
end
|
||||
|
||||
document print_zstr
|
||||
print the length and contents of a zend string
|
||||
usage: print_zstr <ptr> [max length]
|
||||
end
|
||||
|
||||
define zbacktrace
|
||||
____executor_globals
|
||||
dump_bt $eg.current_execute_data
|
||||
@@ -566,79 +610,6 @@ document zbacktrace
|
||||
> (gdb) dump_bt $eg.current_execute_data
|
||||
end
|
||||
|
||||
define zmemcheck
|
||||
set $p = alloc_globals.head
|
||||
set $stat = "?"
|
||||
set $total_size = 0
|
||||
if $arg0 != 0
|
||||
set $not_found = 1
|
||||
else
|
||||
set $not_found = 0
|
||||
end
|
||||
printf " block size status file:line\n"
|
||||
printf "-------------------------------------------------------------------------------\n"
|
||||
while $p
|
||||
set $aptr = $p + sizeof(struct _zend_mem_header) + sizeof(align_test)
|
||||
if $arg0 == 0 || (void *)$aptr == (void *)$arg0
|
||||
if $p->magic == 0x7312f8dc
|
||||
set $stat = "OK"
|
||||
end
|
||||
if $p->magic == 0x99954317
|
||||
set $stat = "FREED"
|
||||
end
|
||||
if $p->magic == 0xfb8277dc
|
||||
set $stat = "CACHED"
|
||||
end
|
||||
set $filename = strrchr($p->filename->val, '/')
|
||||
if !$filename
|
||||
set $filename = $p->filename->val
|
||||
else
|
||||
set $filename = $filename + 1
|
||||
end
|
||||
printf " %p ", $aptr
|
||||
if $p->size == sizeof(struct _zval_struct) && ((struct _zval_struct *)$aptr)->type >= 0 && ((struct _zval_struct *)$aptr)->type < 10
|
||||
printf "ZVAL?(%-2d) ", $p->size
|
||||
else
|
||||
printf "%-9d ", $p->size
|
||||
end
|
||||
set $total_size = $total_size + $p->size
|
||||
printf "%-06s %s:%d", $stat, $filename, $p->lineno
|
||||
if $p->orig_filename
|
||||
set $orig_filename = strrchr($p->orig_filename, '/')
|
||||
if !$orig_filename
|
||||
set $orig_filename = $p->orig_filename
|
||||
else
|
||||
set $orig_filename = $orig_filename + 1
|
||||
end
|
||||
printf " <= %s:%d\n", $orig_filename, $p->orig_lineno
|
||||
else
|
||||
printf "\n"
|
||||
end
|
||||
if $arg0 != 0
|
||||
set $p = 0
|
||||
set $not_found = 0
|
||||
else
|
||||
set $p = $p->pNext
|
||||
end
|
||||
else
|
||||
set $p = $p->pNext
|
||||
end
|
||||
end
|
||||
if $not_found
|
||||
printf "no such block that begins at %p.\n", $aptr
|
||||
end
|
||||
if $arg0 == 0
|
||||
printf "-------------------------------------------------------------------------------\n"
|
||||
printf " total: %d bytes\n", $total_size
|
||||
end
|
||||
end
|
||||
|
||||
document zmemcheck
|
||||
show status of a memory block.
|
||||
usage: zmemcheck [ptr].
|
||||
if ptr is 0, all blocks will be listed.
|
||||
end
|
||||
|
||||
define lookup_root
|
||||
set $found = 0
|
||||
if gc_globals->roots
|
||||
|
||||
+1
-1
@@ -286,7 +286,7 @@ MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: gd
|
||||
PRIMARY MAINTAINER: Pierre-Alain Joye <pajoye@php.net>
|
||||
PRIMARY MAINTAINER: Pierre-Alain Joye <pajoye@php.net>, Christoph M. Becker <cmb@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ install-headers:
|
||||
paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
|
||||
done; \
|
||||
$(mkinstalldirs) $$paths && \
|
||||
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
|
||||
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
|
||||
for i in `echo $(INSTALL_HEADERS)`; do \
|
||||
if test "$(PHP_PECL_EXTENSION)"; then \
|
||||
src=`echo $$i | $(SED) -e "s#ext/$(PHP_PECL_EXTENSION)/##g"`; \
|
||||
|
||||
@@ -1,8 +1,156 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2017 PHP 7.0.16
|
||||
16 Mar 2017 PHP 7.0.17
|
||||
|
||||
- Core:
|
||||
. Fixed bug #73989 (PHP 7.1 Segfaults within Symfony test suite).
|
||||
(Dmitry, Laruence)
|
||||
. Fixed bug #74084 (Out of bound read - zend_mm_alloc_small). (Laruence)
|
||||
. Fixed bug #73807 (Performance problem with processing large post request).
|
||||
(Nikita)
|
||||
. Fixed bug #73998 (array_key_exists fails on arrays created by
|
||||
get_object_vars). (mhagstrand)
|
||||
. Fixed bug #73954 (NAN check fails on Alpine Linux with musl). (Andrea)
|
||||
. Fixed bug #74039 (is_infinite(-INF) returns false). (Christian Schmidt)
|
||||
. Fixed bug #73677 (Generating phar.phar core dump with gcc ASAN enabled
|
||||
build). (ondrej)
|
||||
|
||||
- Apache:
|
||||
. Fixed bug #61471 (Incomplete POST does not timeout but is passed to PHP).
|
||||
(Zheng Shao)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #72719 (Relative datetime format ignores weekday on sundays
|
||||
only). (Derick)
|
||||
. Fixed bug #73294 (DateTime wrong when date string is negative). (Derick)
|
||||
. Fixed bug #73489 (wrong timestamp when call setTimeZone multi times with
|
||||
UTC offset). (xiami, Derick)
|
||||
. Fixed bug #73858 (first/last day of' flag is not being reset). (Derick)
|
||||
. Fixed bug #73942 ($date->modify('Friday this week') doesn't return a Friday
|
||||
if $date is a Sunday). (Derick)
|
||||
. Fixed bug #74057 (wrong day when using "this week" in strtotime). (Derick)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #69860 (php-fpm process accounting is broken with keepalive).
|
||||
(Denis Yeldandi)
|
||||
|
||||
- Hash:
|
||||
. Fixed bug #73127 (gost-crypto hash incorrect if input data contains long
|
||||
0xFF sequence). (Grundik)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #74031 (ReflectionFunction for imagepng is missing last two
|
||||
parameters). (finwe)
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed bug #74021 (fetch_array broken data. Data more then MEDIUMBLOB).
|
||||
(Andrew Nester, Nikita)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #74152 (if statement says true to a null variable). (Laruence)
|
||||
. Fixed bug #74019 (Segfault with list). (Laruence)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #74022 (PHP Fast CGI crashes when reading from a pfx file).
|
||||
(Anatol)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #74148 (ReflectionFunction incorrectly reports the number of
|
||||
arguments). (Laruence)
|
||||
. Fixed bug #74005 (mail.add_x_header causes RFC-breaking lone line feed).
|
||||
(Anatol)
|
||||
. Fixed bug #73118 (is_callable callable name reports misleading value for
|
||||
anonymous classes). (Adam Saponara)
|
||||
. Fixed bug #74105 (PHP on Linux should use /dev/urandom when getrandom is
|
||||
not available). (Benjamin Robin)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug #73496 (Invalid memory access in zend_inline_hash_func).
|
||||
(Laruence)
|
||||
. Fixed bug #74090 (stream_get_contents maxlength>-1 returns empty string).
|
||||
(Anatol)
|
||||
|
||||
|
||||
16 Feb 2017 PHP 7.0.16
|
||||
|
||||
- Core:
|
||||
. Fixed bug #73916 (zend_print_flat_zval_r doesn't consider reference).
|
||||
(Laruence)
|
||||
. Fixed bug #73876 (Crash when exporting **= in expansion of assign op).
|
||||
(Sara)
|
||||
. Fixed bug #73969 (segfault in debug_print_backtrace). (andrewnester)
|
||||
. Fixed bug #73973 (assertion error in debug_zval_dump). (andrewnester)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug #54382 (getAttributeNodeNS doesn't get xmlns* attributes).
|
||||
(aboks)
|
||||
|
||||
- DTrace:
|
||||
. Fixed bug #73965 (DTrace reported as enabled when disabled). (Remi)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #67583 (double fastcgi_end_request on max_children limit).
|
||||
(Dmitry Saprykin)
|
||||
. Fixed bug #69865 (php-fpm does not close stderr when using syslog).
|
||||
(m6w6)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #73968 (Premature failing of XBM reading). (cmb)
|
||||
|
||||
- GMP:
|
||||
. Fixed bug #69993 (test for gmp.h needs to test machine includes).
|
||||
(Jordan Gigov)
|
||||
|
||||
- Intl:
|
||||
. Fix bug #73956 (Link use CC instead of CXX). (Remi)
|
||||
|
||||
- LDAP:
|
||||
. Fixed bug #73933 (error/segfault with ldap_mod_replace and opcache).
|
||||
(Laruence)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #73949 (leak in mysqli_fetch_object). (krakjoe)
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed bug #69899 (segfault on close() after free_result() with mysqlnd).
|
||||
(Richard Fussenegger)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #73983 (crash on finish work with phar in cli + opcache).
|
||||
(Anatol)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #71519 (add serial hex to return value array). (xrobau)
|
||||
|
||||
- PDO_Firebird:
|
||||
. Implemented FR #72583 (All data are fetched as strings). (Dorin Marcoci)
|
||||
|
||||
- PDO_PgSQL:
|
||||
. Fixed bug #73959 (lastInsertId fails to throw an exception for wrong
|
||||
sequence name). (andrewnester)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #70417 (PharData::compress() doesn't close temp file). (cmb)
|
||||
|
||||
- posix:
|
||||
. Fixed bug #71219 (configure script incorrectly checks for ttyname_r). (atoth)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #69582 (session not readable by root in CLI). (EvgeniySpinov)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #73896 (spl_autoload() crashes when calls magic _call()). (Dmitry)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #69442 (closing of fd incorrect when PTS enabled). (jaytaph)
|
||||
. Fixed bug #47021 (SoapClient stumbles over WSDL delivered with
|
||||
"Transfer-Encoding: chunked"). (Rowan Collins)
|
||||
. Fixed bug #72974 (imap is undefined service on AIX). (matthieu.sarter)
|
||||
. Fixed bug #72979 (money_format stores wrong length AIX). (matthieu.sarter)
|
||||
|
||||
- ZIP:
|
||||
. Fixed bug #70103 (ZipArchive::addGlob ignores remove_all_path option). (cmb,
|
||||
Mitch Hagstrand)
|
||||
|
||||
19 Jan 2017 PHP 7.0.15
|
||||
|
||||
@@ -13,6 +161,15 @@ PHP NEWS
|
||||
. Fixed bug #73585 (Logging of "Internal Zend error - Missing class
|
||||
information" missing class name). (Laruence)
|
||||
. Fixed bug #73753 (unserialized array pointer not advancing). (David Walker)
|
||||
. Fixed bug #73825 (Heap out of bounds read on unserialize in
|
||||
finish_nested_data()). (Stas)
|
||||
. Fixed bug #73831 (NULL Pointer Dereference while unserialize php object).
|
||||
(Stas)
|
||||
. Fixed bug #73832 (Use of uninitialized memory in unserialize()). (Stas)
|
||||
. Fixed bug #73092 (Unserialize use-after-free when resizing object's
|
||||
properties hash table). (Nikita)
|
||||
. Fixed bug #69425 (Use After Free in unserialize()). (Nikita)
|
||||
. Fixed bug #72731 (Type Confusion in Object Deserialization). (Nikita)
|
||||
|
||||
- COM:
|
||||
. Fixed bug #73679 (DOTNET read access violation using invalid codepage).
|
||||
@@ -21,6 +178,17 @@ PHP NEWS
|
||||
- DOM:
|
||||
. Fixed bug #67474 (getElementsByTagNameNS filter on default ns). (aboks)
|
||||
|
||||
- EXIF:
|
||||
. Bug bug #73737 (FPE when parsing a tag format). (Stas)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #73869 (Signed Integer Overflow gd_io.c). (cmb)
|
||||
. Fixed bug #73868 (DOS vulnerability in gdImageCreateFromGd2Ctx()). (cmb)
|
||||
|
||||
- GMP:
|
||||
. Fixed bug #70513 (GMP Deserialization Type Confusion Vulnerability).
|
||||
(Nikita)
|
||||
|
||||
- Mysqli:
|
||||
. Fixed bug #73462 (Persistent connections don't set $connect_errno).
|
||||
(darkain)
|
||||
@@ -38,9 +206,10 @@ PHP NEWS
|
||||
. Fixed bug #72931 (PDO_FIREBIRD with Firebird 3.0 not work on returning
|
||||
statement). (Dorin Marcoci)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug #73586 (php_user_filter::$stream is not set to the stream the
|
||||
filter is working on). (Dmitry)
|
||||
- Phar:
|
||||
. Fixed bug #73773 (Seg fault when loading hostile phar). (Stas)
|
||||
. Fixed bug #73768 (Memory corruption when loading hostile phar). (Stas)
|
||||
. Fixed bug #73764 (Crash while loading hostile phar archive). (Stas)
|
||||
|
||||
- Phpdbg:
|
||||
. Fixed bug #73615 (phpdbg without option never load .phpdbginit at startup).
|
||||
@@ -51,6 +220,10 @@ PHP NEWS
|
||||
- Reflection:
|
||||
. Fixed bug #46103 (ReflectionObject memory leak). (Nikita)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug #73586 (php_user_filter::$stream is not set to the stream the
|
||||
filter is working on). (Dmitry)
|
||||
|
||||
- SQLite3:
|
||||
. Reverted fix for bug #73530 (Unsetting result set may reset other result
|
||||
set). (cmb)
|
||||
|
||||
+12
-9
@@ -93,24 +93,27 @@ Commit the changes to the main branch.
|
||||
12. run: ``PHPROOT=. ./makedist 5.4.2RC2``, this will export the tree, create configure
|
||||
and build three tarballs (gz, bz2 and xz).
|
||||
|
||||
13. Copy those tarballs (scp, rsync) to downloads.php.net, in your homedir there should be a
|
||||
13. run ``scripts/dev/gen_verify_stub <version> [identity]``, this will sign the tarballs
|
||||
and output verification information to be included in announcement email
|
||||
|
||||
14. Copy those tarballs (scp, rsync) to downloads.php.net, in your homedir there should be a
|
||||
directory "downloads/". Copy them into there, so that the system can generate
|
||||
MD5 sums. If you do not have this directory, talk to Derick or Dan.
|
||||
|
||||
14. Now the RC can be found on http://downloads.php.net/yourname,
|
||||
15. Now the RC can be found on http://downloads.php.net/yourname,
|
||||
f.e. http://downloads.php.net/derick/
|
||||
|
||||
15. Once the release has been tagged, contact the PHP Windows development team
|
||||
16. Once the release has been tagged, contact the PHP Windows development team
|
||||
(internals-win@lists.php.net) so that Windows binaries can be created. Once
|
||||
those are made, they should be placed into the same directory as the source snapshots.
|
||||
|
||||
Getting the non stable release (alpha/beta/RC) announced
|
||||
--------------------------------------------------------
|
||||
|
||||
1. Send an email (see example here: http://news.php.net/php.internals/19486)
|
||||
**To** ``internals@lists.php.net`` and ``php-general@lists.php.net`` lists
|
||||
pointing out "the location of the release" and "the possible release date of
|
||||
either the next RC, or the final release".
|
||||
1. Send an email **To** ``internals@lists.php.net`` and ``php-general@lists.php.net``
|
||||
lists pointing out "the location of the release" and "the possible release date of
|
||||
either the next RC, or the final release". Include in this information the verification
|
||||
information output by ``gen_verify_stub``.
|
||||
|
||||
2. Send an email (see example here http://news.php.net/php.pear.qa/5201) **To**
|
||||
``php-qa@lists.php.net`` and ``primary-qa-tester@lists.php.net``.
|
||||
@@ -190,8 +193,8 @@ Check if the pear files are updated (phar).
|
||||
This is to fetch the last commit id from php-distributions.git and commit this
|
||||
last commit id to web/php.git, then, mirrors will now sync
|
||||
|
||||
12. Once the release has been tagged, contact the PHP Windows development team
|
||||
(internals-win@lists.php.net) so that Windows binaries can be created.
|
||||
12. Once the release has been tagged, contact release managers, windows builders, and package maintainers
|
||||
so that they can build releases. Do not send this announcement to any public lists.
|
||||
|
||||
Getting the stable release announced
|
||||
------------------------------------
|
||||
|
||||
@@ -652,6 +652,11 @@ Other
|
||||
Since 7.0.9, getenv() has optional second parameter, making it only
|
||||
consider local environment and not SAPI environment if true.
|
||||
|
||||
- fopen()
|
||||
Since 7.0.16, mode 'e' was added, which sets the close-on-exec flag
|
||||
on the opened file descriptor. This mode is only available in PHP compiled on
|
||||
POSIX.1-2008 conform systems.
|
||||
|
||||
========================================
|
||||
6. New Functions
|
||||
========================================
|
||||
@@ -722,6 +727,13 @@ out, that the corresponding SDK isn't available anymore.
|
||||
Mhash is not an extension anymore, use function_exists("mhash") to check whether
|
||||
it is avaliable.
|
||||
|
||||
- PDO_Firebird
|
||||
As of PHP 7.0.16, the fetched data for integer fields is aware of the Firebird
|
||||
datatypes. Previously all integers was fetched as strings, starting with the
|
||||
aforementioned PHP version integer fields are translated to the PHP integer
|
||||
datatype. The 64-bit integers are still fetched as strings in 32-bit PHP
|
||||
builds.
|
||||
|
||||
- GD
|
||||
The bundled libgd requires libwebp instead of libvpx for the WebP functionality.
|
||||
|
||||
@@ -788,6 +800,7 @@ out, that the corresponding SDK isn't available anymore.
|
||||
. Removed asp_tags ini directive. Trying to enable it will result in a fatal
|
||||
error.
|
||||
. Removed always_populate_raw_post_data ini directive.
|
||||
. realpath_cache_size set to 4096k by default
|
||||
|
||||
========================================
|
||||
12. Windows Support
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ AC_FUNC_ALLOCA
|
||||
AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol finite fpclass sigsetjmp)
|
||||
AC_ZEND_BROKEN_SPRINTF
|
||||
|
||||
AC_CHECK_FUNCS(finite isfinite isinf isnan)
|
||||
AC_CHECK_DECLS([isfinite, isnan, isinf], [], [], [[#include <math.h>]])
|
||||
|
||||
ZEND_FP_EXCEPT
|
||||
|
||||
|
||||
+8
-8
@@ -64,33 +64,33 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
/* To enable the is_nan, is_infinite and is_finite PHP functions */
|
||||
#ifdef NETWARE
|
||||
#define HAVE_ISNAN 1
|
||||
#define HAVE_ISINF 1
|
||||
#define HAVE_ISFINITE 1
|
||||
#define HAVE_DECL_ISNAN 1
|
||||
#define HAVE_DECL_ISINF 1
|
||||
#define HAVE_DECL_ISFINITE 1
|
||||
#endif
|
||||
|
||||
#ifndef zend_isnan
|
||||
#ifdef HAVE_ISNAN
|
||||
#ifdef HAVE_DECL_ISNAN
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
#else
|
||||
#define zend_isnan(a) 0
|
||||
#define zend_isnan(a) ((a) != (a))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ISINF
|
||||
#ifdef HAVE_DECL_ISINF
|
||||
#define zend_isinf(a) isinf(a)
|
||||
#elif defined(INFINITY)
|
||||
/* Might not work, but is required by ISO C99 */
|
||||
#define zend_isinf(a) (((a)==INFINITY)?1:0)
|
||||
#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
|
||||
#else
|
||||
#define zend_isinf(a) 0
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_ISFINITE) || defined(isfinite)
|
||||
#if defined(HAVE_DECL_ISFINITE)
|
||||
#define zend_finite(a) isfinite(a)
|
||||
#elif defined(HAVE_FINITE)
|
||||
#define zend_finite(a) finite(a)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
ZEND_POW_ASSIGN
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
assert_options(ASSERT_WARNING);
|
||||
assert(false && ($a **= 2));
|
||||
--EXPECTF--
|
||||
Warning: assert(): assert(false && ($a **= 2)) failed in %s%ezend-pow-assign.php on line %d
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #73916 (zend_print_flat_zval_r doesn't consider reference)
|
||||
--FILE--
|
||||
<?php
|
||||
$a = array('a');
|
||||
class b{};
|
||||
$b = new b;
|
||||
$test[] =& $a;
|
||||
$test[] =& $b;
|
||||
test($test);
|
||||
function test() {
|
||||
debug_print_backtrace();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
#0 test(Array ([0] => Array ([0] => a),[1] => b Object ())) called at [%sbug73916.php:%d]
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #73954 (NAN check fails on Alpine Linux with musl)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(NAN);
|
||||
var_dump(is_nan(NAN));
|
||||
|
||||
function takes_int(int $int) {
|
||||
}
|
||||
|
||||
takes_int(log(tan(3.14)));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
float(NAN)
|
||||
bool(true)
|
||||
|
||||
Fatal error: Uncaught TypeError: Argument 1 passed to takes_int() must be of the type integer, float given, called in %s on line 9 and defined in %s:6
|
||||
Stack trace:
|
||||
#0 %s(9): takes_int(NAN)
|
||||
#1 {main}
|
||||
thrown in %s on line 6
|
||||
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #73989 (PHP 7.1 Segfaults within Symfony test suite)
|
||||
--FILE--
|
||||
<?php
|
||||
class Cycle
|
||||
{
|
||||
private $thing;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$obj = $this;
|
||||
$this->thing = function() use($obj) {};
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
($this->thing)();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for ($i = 0; $i < 10000; ++$i) {
|
||||
$obj = new Cycle();
|
||||
}
|
||||
echo "OK\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #73998 (array_key_exists fails on arrays created by get_object_vars)
|
||||
--DESCRIPTION--
|
||||
Properties of objects with numeric names should be accessible
|
||||
--FILE--
|
||||
<?php
|
||||
$a = new stdClass;
|
||||
$a->{1234} = "Numeric";
|
||||
$a->a1234 = "String";
|
||||
|
||||
$properties = get_object_vars($a);
|
||||
var_dump(array_key_exists(1234, $properties));
|
||||
echo "Value: {$properties[1234]}\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
Value: Numeric
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #74084 (Out of bound read - zend_mm_alloc_small)
|
||||
--INI--
|
||||
error_reporting=0
|
||||
--FILE--
|
||||
<?php
|
||||
$$A += $$B->a = &$$C;
|
||||
unset($$A);
|
||||
$$A -= $$B->a = &$$C;
|
||||
unset($$A);
|
||||
$$A *= $$B->a = &$$C;
|
||||
unset($$A);
|
||||
$$A /= $$B->a = &$$C;
|
||||
unset($$A);
|
||||
$$A **= $$B->a = &$$C;
|
||||
var_dump($$A);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
@@ -152,6 +152,7 @@ ZEND_TSRMLS_CACHE_DEFINE()
|
||||
#endif
|
||||
|
||||
ZEND_API zend_utility_values zend_uv;
|
||||
ZEND_API zend_bool zend_dtrace_enabled;
|
||||
|
||||
/* version information */
|
||||
static char *zend_version_info;
|
||||
@@ -312,6 +313,9 @@ ZEND_API void zend_print_flat_zval_r(zval *expr) /* {{{ */
|
||||
ZEND_PUTS(")");
|
||||
break;
|
||||
}
|
||||
case IS_REFERENCE:
|
||||
zend_print_flat_zval_r(Z_REFVAL_P(expr));
|
||||
break;
|
||||
default:
|
||||
zend_print_variable(expr);
|
||||
break;
|
||||
@@ -563,6 +567,7 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals) /* {{
|
||||
#ifdef ZEND_WIN32
|
||||
zend_get_windows_version_info(&executor_globals->windows_version_info);
|
||||
#endif
|
||||
executor_globals->valid_symbol_table = 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -682,6 +687,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) /
|
||||
char *tmp = getenv("USE_ZEND_DTRACE");
|
||||
|
||||
if (tmp && zend_atoi(tmp, 0)) {
|
||||
zend_dtrace_enabled = 1;
|
||||
zend_compile_file = dtrace_compile_file;
|
||||
zend_execute_ex = dtrace_execute_ex;
|
||||
zend_execute_internal = dtrace_execute_internal;
|
||||
|
||||
@@ -299,6 +299,8 @@ extern ZEND_API zend_class_entry *zend_standard_class_def;
|
||||
extern ZEND_API zend_utility_values zend_uv;
|
||||
extern ZEND_API zval zval_used_for_init;
|
||||
|
||||
/* If DTrace is available and enabled */
|
||||
extern ZEND_API zend_bool zend_dtrace_enabled;
|
||||
END_EXTERN_C()
|
||||
|
||||
#define ZEND_UV(name) (zend_uv.name)
|
||||
|
||||
+1
-1
@@ -1344,7 +1344,7 @@ simple_list:
|
||||
case ZEND_ASSIGN_BW_OR: BINARY_OP(" |= ", 90, 91, 90);
|
||||
case ZEND_ASSIGN_BW_AND: BINARY_OP(" &= ", 90, 91, 90);
|
||||
case ZEND_ASSIGN_BW_XOR: BINARY_OP(" ^= ", 90, 91, 90);
|
||||
case ZEND_POW: BINARY_OP(" **= ", 90, 91, 90);
|
||||
case ZEND_ASSIGN_POW: BINARY_OP(" **= ", 90, 91, 90);
|
||||
EMPTY_SWITCH_DEFAULT_CASE();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -808,9 +808,6 @@ static void copy_constant_array(zval *dst, zval *src) /* {{{ */
|
||||
}
|
||||
} else if (Z_REFCOUNTED_P(val)) {
|
||||
Z_ADDREF_P(val);
|
||||
if (UNEXPECTED(Z_TYPE_INFO_P(val) == IS_RESOURCE_EX)) {
|
||||
Z_TYPE_INFO_P(new_val) &= ~(IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT);
|
||||
}
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
@@ -853,12 +850,7 @@ repeat:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
case IS_NULL:
|
||||
break;
|
||||
case IS_RESOURCE:
|
||||
ZVAL_COPY(&val_free, val);
|
||||
/* TODO: better solution than this tricky disable dtor on resource? */
|
||||
Z_TYPE_INFO(val_free) &= ~(IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT);
|
||||
val = &val_free;
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
if (!Z_IMMUTABLE_P(val)) {
|
||||
@@ -1154,6 +1146,8 @@ ZEND_FUNCTION(get_object_vars)
|
||||
HashTable *properties;
|
||||
zend_string *key;
|
||||
zend_object *zobj;
|
||||
zend_ulong index;
|
||||
zend_bool fast_copy = 0;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_OBJECT(obj)
|
||||
@@ -1172,7 +1166,17 @@ ZEND_FUNCTION(get_object_vars)
|
||||
zobj = Z_OBJ_P(obj);
|
||||
|
||||
if (!zobj->ce->default_properties_count && properties == zobj->properties && !ZEND_HASH_GET_APPLY_COUNT(properties)) {
|
||||
/* fast copy */
|
||||
fast_copy = 1;
|
||||
/* Check if the object has a numeric property, See Bug 73998 */
|
||||
ZEND_HASH_FOREACH_STR_KEY(properties, key) {
|
||||
if (key && ZEND_HANDLE_NUMERIC(key, index)) {
|
||||
fast_copy = 0;
|
||||
break;
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
|
||||
if (fast_copy) {
|
||||
if (EXPECTED(zobj->handlers == &std_object_handlers)) {
|
||||
if (EXPECTED(!(GC_FLAGS(properties) & IS_ARRAY_IMMUTABLE))) {
|
||||
GC_REFCOUNT(properties)++;
|
||||
@@ -1198,7 +1202,7 @@ ZEND_FUNCTION(get_object_vars)
|
||||
zend_unmangle_property_name_ex(key, &class_name, &prop_name, &prop_len);
|
||||
zend_hash_str_add_new(Z_ARRVAL_P(return_value), prop_name, prop_len, value);
|
||||
} else {
|
||||
zend_hash_add_new(Z_ARRVAL_P(return_value), key, value);
|
||||
zend_symbtable_add_new(Z_ARRVAL_P(return_value), key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2364,13 +2368,19 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
object = Z_OBJ(call->This);
|
||||
|
||||
if (call->func) {
|
||||
zend_string *zend_function_name;
|
||||
|
||||
func = call->func;
|
||||
function_name = (func->common.scope &&
|
||||
func->common.scope->trait_aliases) ?
|
||||
ZSTR_VAL(zend_resolve_method_name(
|
||||
(object ? object->ce : func->common.scope), func)) :
|
||||
(func->common.function_name ?
|
||||
ZSTR_VAL(func->common.function_name) : NULL);
|
||||
if (func->common.scope && func->common.scope->trait_aliases) {
|
||||
zend_function_name = zend_resolve_method_name(object ? object->ce : func->common.scope, func);
|
||||
} else {
|
||||
zend_function_name = func->common.function_name;
|
||||
}
|
||||
if (zend_function_name != NULL) {
|
||||
function_name = ZSTR_VAL(zend_function_name);
|
||||
} else {
|
||||
function_name = NULL;
|
||||
}
|
||||
} else {
|
||||
func = NULL;
|
||||
function_name = NULL;
|
||||
|
||||
@@ -556,8 +556,8 @@ static void _build_trace_args(zval *arg, smart_str *str) /* {{{ */
|
||||
break;
|
||||
case IS_DOUBLE: {
|
||||
double dval = Z_DVAL_P(arg);
|
||||
char *s_tmp = emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
|
||||
int l_tmp = zend_sprintf(s_tmp, "%.*G", (int) EG(precision), dval); /* SAFE */
|
||||
char *s_tmp;
|
||||
size_t l_tmp = zend_spprintf(&s_tmp, MAX_LENGTH_OF_DOUBLE + EG(precision) + 1, "%.*G", (int) EG(precision), dval); /* SAFE */
|
||||
smart_str_appendl(str, s_tmp, l_tmp);
|
||||
smart_str_appends(str, ", ");
|
||||
efree(s_tmp);
|
||||
|
||||
@@ -343,6 +343,10 @@ void shutdown_executor(void) /* {{{ */
|
||||
zend_llist_destroy(&CG(open_files));
|
||||
} zend_end_try();
|
||||
|
||||
zend_try {
|
||||
clean_non_persistent_constants();
|
||||
} zend_end_try();
|
||||
|
||||
zend_try {
|
||||
zend_close_rsrc_list(&EG(regular_list));
|
||||
} zend_end_try();
|
||||
@@ -374,10 +378,6 @@ void shutdown_executor(void) /* {{{ */
|
||||
}
|
||||
} zend_end_try();
|
||||
|
||||
zend_try {
|
||||
clean_non_persistent_constants();
|
||||
} zend_end_try();
|
||||
|
||||
zend_try {
|
||||
#if 0&&ZEND_DEBUG
|
||||
signal(SIGSEGV, original_sigsegv_handler);
|
||||
|
||||
+71
-52
@@ -25,26 +25,12 @@
|
||||
/* one (0) is reserved */
|
||||
#define GC_ROOT_BUFFER_MAX_ENTRIES 10001
|
||||
|
||||
#define GC_FAKE_BUFFER_FLAG 0x80
|
||||
#define GC_TYPE_MASK 0x7f
|
||||
|
||||
#define GC_HAS_DESTRUCTORS (1<<0)
|
||||
|
||||
#ifndef ZEND_GC_DEBUG
|
||||
# define ZEND_GC_DEBUG 0
|
||||
#endif
|
||||
|
||||
#define GC_NUM_ADDITIONAL_ENTRIES \
|
||||
((4096 - ZEND_MM_OVERHEAD - sizeof(void*) * 2) / sizeof(gc_root_buffer))
|
||||
|
||||
typedef struct _gc_addtional_bufer gc_additional_buffer;
|
||||
|
||||
struct _gc_addtional_bufer {
|
||||
uint32_t used;
|
||||
gc_additional_buffer *next;
|
||||
gc_root_buffer buf[GC_NUM_ADDITIONAL_ENTRIES];
|
||||
};
|
||||
|
||||
#ifdef ZTS
|
||||
ZEND_API int gc_globals_id;
|
||||
#else
|
||||
@@ -53,9 +39,6 @@ ZEND_API zend_gc_globals gc_globals;
|
||||
|
||||
ZEND_API int (*gc_collect_cycles)(void);
|
||||
|
||||
#define GC_REMOVE_FROM_ROOTS(current) \
|
||||
gc_remove_from_roots((current))
|
||||
|
||||
#if ZEND_GC_DEBUG > 1
|
||||
# define GC_TRACE(format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__);
|
||||
# define GC_TRACE_REF(ref, format, ...) \
|
||||
@@ -123,6 +106,12 @@ static zend_always_inline void gc_remove_from_roots(gc_root_buffer *root)
|
||||
GC_BENCH_DEC(root_buf_length);
|
||||
}
|
||||
|
||||
static zend_always_inline void gc_remove_from_additional_roots(gc_root_buffer *root)
|
||||
{
|
||||
root->next->prev = root->prev;
|
||||
root->prev->next = root->next;
|
||||
}
|
||||
|
||||
static void root_buffer_dtor(zend_gc_globals *gc_globals)
|
||||
{
|
||||
if (gc_globals->buf) {
|
||||
@@ -149,6 +138,8 @@ static void gc_globals_ctor_ex(zend_gc_globals *gc_globals)
|
||||
gc_globals->gc_runs = 0;
|
||||
gc_globals->collected = 0;
|
||||
|
||||
gc_globals->additional_buffer = NULL;
|
||||
|
||||
#if GC_BENCH
|
||||
gc_globals->root_buf_length = 0;
|
||||
gc_globals->root_buf_peak = 0;
|
||||
@@ -204,6 +195,8 @@ ZEND_API void gc_reset(void)
|
||||
GC_G(first_unused) = NULL;
|
||||
GC_G(last_unused) = NULL;
|
||||
}
|
||||
|
||||
GC_G(additional_buffer) = NULL;
|
||||
}
|
||||
|
||||
ZEND_API void gc_init(void)
|
||||
@@ -276,21 +269,42 @@ ZEND_API void ZEND_FASTCALL gc_possible_root(zend_refcounted *ref)
|
||||
GC_BENCH_PEAK(root_buf_peak, root_buf_length);
|
||||
}
|
||||
|
||||
static zend_always_inline gc_root_buffer* gc_find_additional_buffer(zend_refcounted *ref)
|
||||
{
|
||||
gc_additional_buffer *additional_buffer = GC_G(additional_buffer);
|
||||
|
||||
/* We have to check each additional_buffer to find which one holds the ref */
|
||||
while (additional_buffer) {
|
||||
gc_root_buffer *root = additional_buffer->buf + (GC_ADDRESS(GC_INFO(ref)) - GC_ROOT_BUFFER_MAX_ENTRIES);
|
||||
if (root->ref == ref) {
|
||||
return root;
|
||||
}
|
||||
additional_buffer = additional_buffer->next;
|
||||
}
|
||||
|
||||
ZEND_ASSERT(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ZEND_API void ZEND_FASTCALL gc_remove_from_buffer(zend_refcounted *ref)
|
||||
{
|
||||
gc_root_buffer *root;
|
||||
|
||||
ZEND_ASSERT(GC_ADDRESS(GC_INFO(ref)));
|
||||
ZEND_ASSERT(GC_ADDRESS(GC_INFO(ref)) < GC_ROOT_BUFFER_MAX_ENTRIES);
|
||||
|
||||
GC_BENCH_INC(zval_remove_from_buffer);
|
||||
|
||||
root = GC_G(buf) + GC_ADDRESS(GC_INFO(ref));
|
||||
if (EXPECTED(GC_ADDRESS(GC_INFO(ref)) < GC_ROOT_BUFFER_MAX_ENTRIES)) {
|
||||
root = GC_G(buf) + GC_ADDRESS(GC_INFO(ref));
|
||||
gc_remove_from_roots(root);
|
||||
} else {
|
||||
root = gc_find_additional_buffer(ref);
|
||||
gc_remove_from_additional_roots(root);
|
||||
}
|
||||
if (GC_REF_GET_COLOR(ref) != GC_BLACK) {
|
||||
GC_TRACE_SET_COLOR(ref, GC_PURPLE);
|
||||
}
|
||||
GC_INFO(ref) = 0;
|
||||
GC_REMOVE_FROM_ROOTS(root);
|
||||
|
||||
/* updete next root that is going to be freed */
|
||||
if (GC_G(next_to_free) == root) {
|
||||
@@ -641,7 +655,7 @@ static void gc_scan_roots(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void gc_add_garbage(zend_refcounted *ref, gc_additional_buffer **additional_buffer)
|
||||
static void gc_add_garbage(zend_refcounted *ref)
|
||||
{
|
||||
gc_root_buffer *buf = GC_G(unused);
|
||||
|
||||
@@ -664,25 +678,23 @@ static void gc_add_garbage(zend_refcounted *ref, gc_additional_buffer **addition
|
||||
#endif
|
||||
} else {
|
||||
/* If we don't have free slots in the buffer, allocate a new one and
|
||||
* set it's address to GC_ROOT_BUFFER_MAX_ENTRIES that have special
|
||||
* set it's address above GC_ROOT_BUFFER_MAX_ENTRIES that have special
|
||||
* meaning.
|
||||
*/
|
||||
if (!*additional_buffer || (*additional_buffer)->used == GC_NUM_ADDITIONAL_ENTRIES) {
|
||||
if (!GC_G(additional_buffer) || GC_G(additional_buffer)->used == GC_NUM_ADDITIONAL_ENTRIES) {
|
||||
gc_additional_buffer *new_buffer = emalloc(sizeof(gc_additional_buffer));
|
||||
new_buffer->used = 0;
|
||||
new_buffer->next = *additional_buffer;
|
||||
*additional_buffer = new_buffer;
|
||||
new_buffer->next = GC_G(additional_buffer);
|
||||
GC_G(additional_buffer) = new_buffer;
|
||||
}
|
||||
buf = (*additional_buffer)->buf + (*additional_buffer)->used;
|
||||
(*additional_buffer)->used++;
|
||||
buf = GC_G(additional_buffer)->buf + GC_G(additional_buffer)->used;
|
||||
#if 1
|
||||
/* optimization: color is already GC_BLACK (0) */
|
||||
GC_INFO(ref) = GC_ROOT_BUFFER_MAX_ENTRIES;
|
||||
GC_INFO(ref) = GC_ROOT_BUFFER_MAX_ENTRIES + GC_G(additional_buffer)->used;
|
||||
#else
|
||||
GC_REF_SET_ADDRESS(ref, GC_ROOT_BUFFER_MAX_ENTRIES);
|
||||
GC_REF_SET_ADDRESS(ref, GC_ROOT_BUFFER_MAX_ENTRIES) + GC_G(additional_buffer)->used;
|
||||
#endif
|
||||
/* modify type to prevent indirect destruction */
|
||||
GC_TYPE(ref) |= GC_FAKE_BUFFER_FLAG;
|
||||
GC_G(additional_buffer)->used++;
|
||||
}
|
||||
if (buf) {
|
||||
GC_REFCOUNT(ref)++;
|
||||
@@ -694,7 +706,7 @@ static void gc_add_garbage(zend_refcounted *ref, gc_additional_buffer **addition
|
||||
}
|
||||
}
|
||||
|
||||
static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_additional_buffer **additional_buffer)
|
||||
static int gc_collect_white(zend_refcounted *ref, uint32_t *flags)
|
||||
{
|
||||
int count = 0;
|
||||
HashTable *ht;
|
||||
@@ -727,7 +739,7 @@ tail_call:
|
||||
#else
|
||||
if (!GC_ADDRESS(GC_INFO(ref))) {
|
||||
#endif
|
||||
gc_add_garbage(ref, additional_buffer);
|
||||
gc_add_garbage(ref);
|
||||
}
|
||||
if (obj->handlers->dtor_obj &&
|
||||
((obj->handlers->dtor_obj != zend_objects_destroy_object) ||
|
||||
@@ -751,7 +763,7 @@ tail_call:
|
||||
if (Z_REFCOUNTED_P(zv)) {
|
||||
ref = Z_COUNTED_P(zv);
|
||||
GC_REFCOUNT(ref)++;
|
||||
count += gc_collect_white(ref, flags, additional_buffer);
|
||||
count += gc_collect_white(ref, flags);
|
||||
/* count non-refcounted for compatibility ??? */
|
||||
} else if (Z_TYPE_P(zv) != IS_UNDEF) {
|
||||
count++;
|
||||
@@ -773,7 +785,7 @@ tail_call:
|
||||
#else
|
||||
if (!GC_ADDRESS(GC_INFO(ref))) {
|
||||
#endif
|
||||
gc_add_garbage(ref, additional_buffer);
|
||||
gc_add_garbage(ref);
|
||||
}
|
||||
ht = (zend_array*)ref;
|
||||
} else if (GC_TYPE(ref) == IS_REFERENCE) {
|
||||
@@ -813,7 +825,7 @@ tail_call:
|
||||
if (Z_REFCOUNTED_P(zv)) {
|
||||
ref = Z_COUNTED_P(zv);
|
||||
GC_REFCOUNT(ref)++;
|
||||
count += gc_collect_white(ref, flags, additional_buffer);
|
||||
count += gc_collect_white(ref, flags);
|
||||
/* count non-refcounted for compatibility ??? */
|
||||
} else if (Z_TYPE_P(zv) != IS_UNDEF) {
|
||||
count++;
|
||||
@@ -831,7 +843,7 @@ tail_call:
|
||||
return count;
|
||||
}
|
||||
|
||||
static int gc_collect_roots(uint32_t *flags, gc_additional_buffer **additional_buffer)
|
||||
static int gc_collect_roots(uint32_t *flags)
|
||||
{
|
||||
int count = 0;
|
||||
gc_root_buffer *current = GC_G(roots).next;
|
||||
@@ -840,8 +852,12 @@ static int gc_collect_roots(uint32_t *flags, gc_additional_buffer **additional_b
|
||||
while (current != &GC_G(roots)) {
|
||||
gc_root_buffer *next = current->next;
|
||||
if (GC_REF_GET_COLOR(current->ref) == GC_BLACK) {
|
||||
if (EXPECTED(GC_ADDRESS(GC_INFO(current->ref)) < GC_ROOT_BUFFER_MAX_ENTRIES)) {
|
||||
gc_remove_from_roots(current);
|
||||
} else {
|
||||
gc_remove_from_additional_roots(current);
|
||||
}
|
||||
GC_INFO(current->ref) = 0; /* reset GC_ADDRESS() and keep GC_BLACK */
|
||||
GC_REMOVE_FROM_ROOTS(current);
|
||||
}
|
||||
current = next;
|
||||
}
|
||||
@@ -850,7 +866,7 @@ static int gc_collect_roots(uint32_t *flags, gc_additional_buffer **additional_b
|
||||
while (current != &GC_G(roots)) {
|
||||
GC_REFCOUNT(current->ref)++;
|
||||
if (GC_REF_GET_COLOR(current->ref) == GC_WHITE) {
|
||||
count += gc_collect_white(current->ref, flags, additional_buffer);
|
||||
count += gc_collect_white(current->ref, flags);
|
||||
}
|
||||
current = current->next;
|
||||
}
|
||||
@@ -886,13 +902,16 @@ static void gc_remove_nested_data_from_buffer(zend_refcounted *ref, gc_root_buff
|
||||
tail_call:
|
||||
if (root ||
|
||||
(GC_ADDRESS(GC_INFO(ref)) != 0 &&
|
||||
GC_REF_GET_COLOR(ref) == GC_BLACK &&
|
||||
GC_ADDRESS(GC_INFO(ref)) != GC_ROOT_BUFFER_MAX_ENTRIES)) {
|
||||
GC_REF_GET_COLOR(ref) == GC_BLACK)) {
|
||||
GC_TRACE_REF(ref, "removing from buffer");
|
||||
GC_REFCOUNT(ref)--;
|
||||
if (root) {
|
||||
if (EXPECTED(GC_ADDRESS(GC_INFO(root->ref)) < GC_ROOT_BUFFER_MAX_ENTRIES)) {
|
||||
gc_remove_from_roots(root);
|
||||
} else {
|
||||
gc_remove_from_additional_roots(root);
|
||||
}
|
||||
GC_INFO(ref) = 0;
|
||||
GC_REMOVE_FROM_ROOTS(root);
|
||||
root = NULL;
|
||||
} else {
|
||||
GC_REMOVE_FROM_BUFFER(ref);
|
||||
@@ -986,7 +1005,7 @@ ZEND_API int zend_gc_collect_cycles(void)
|
||||
zend_refcounted *p;
|
||||
gc_root_buffer to_free;
|
||||
uint32_t gc_flags = 0;
|
||||
gc_additional_buffer *additional_buffer;
|
||||
gc_additional_buffer *additional_buffer_snapshot;
|
||||
#if ZEND_GC_DEBUG
|
||||
zend_bool orig_gc_full;
|
||||
#endif
|
||||
@@ -1010,8 +1029,8 @@ ZEND_API int zend_gc_collect_cycles(void)
|
||||
#endif
|
||||
|
||||
GC_TRACE("Collecting roots");
|
||||
additional_buffer = NULL;
|
||||
count = gc_collect_roots(&gc_flags, &additional_buffer);
|
||||
additional_buffer_snapshot = GC_G(additional_buffer);
|
||||
count = gc_collect_roots(&gc_flags);
|
||||
#if ZEND_GC_DEBUG
|
||||
GC_G(gc_full) = orig_gc_full;
|
||||
#endif
|
||||
@@ -1055,7 +1074,7 @@ ZEND_API int zend_gc_collect_cycles(void)
|
||||
while (current != &to_free) {
|
||||
p = current->ref;
|
||||
GC_G(next_to_free) = current->next;
|
||||
if ((GC_TYPE(p) & GC_TYPE_MASK) == IS_OBJECT) {
|
||||
if (GC_TYPE(p) == IS_OBJECT) {
|
||||
zend_object *obj = (zend_object*)p;
|
||||
|
||||
if (IS_OBJ_VALID(EG(objects_store).object_buckets[obj->handle]) &&
|
||||
@@ -1092,7 +1111,7 @@ ZEND_API int zend_gc_collect_cycles(void)
|
||||
p = current->ref;
|
||||
GC_G(next_to_free) = current->next;
|
||||
GC_TRACE_REF(p, "destroying");
|
||||
if ((GC_TYPE(p) & GC_TYPE_MASK) == IS_OBJECT) {
|
||||
if (GC_TYPE(p) == IS_OBJECT) {
|
||||
zend_object *obj = (zend_object*)p;
|
||||
|
||||
if (EG(objects_store).object_buckets &&
|
||||
@@ -1111,7 +1130,7 @@ ZEND_API int zend_gc_collect_cycles(void)
|
||||
EG(objects_store).free_list_head = obj->handle;
|
||||
p = current->ref = (zend_refcounted*)(((char*)obj) - obj->handlers->offset);
|
||||
}
|
||||
} else if ((GC_TYPE(p) & GC_TYPE_MASK) == IS_ARRAY) {
|
||||
} else if (GC_TYPE(p) == IS_ARRAY) {
|
||||
zend_array *arr = (zend_array*)p;
|
||||
|
||||
GC_TYPE(arr) = IS_NULL;
|
||||
@@ -1133,10 +1152,10 @@ ZEND_API int zend_gc_collect_cycles(void)
|
||||
current = next;
|
||||
}
|
||||
|
||||
while (additional_buffer != NULL) {
|
||||
gc_additional_buffer *next = additional_buffer->next;
|
||||
efree(additional_buffer);
|
||||
additional_buffer = next;
|
||||
while (GC_G(additional_buffer) != additional_buffer_snapshot) {
|
||||
gc_additional_buffer *next = GC_G(additional_buffer)->next;
|
||||
efree(GC_G(additional_buffer));
|
||||
GC_G(additional_buffer) = next;
|
||||
}
|
||||
|
||||
GC_TRACE("Collection finished");
|
||||
|
||||
@@ -67,6 +67,17 @@ typedef struct _gc_root_buffer {
|
||||
uint32_t refcount;
|
||||
} gc_root_buffer;
|
||||
|
||||
#define GC_NUM_ADDITIONAL_ENTRIES \
|
||||
((4096 - ZEND_MM_OVERHEAD - sizeof(void*) * 2) / sizeof(gc_root_buffer))
|
||||
|
||||
typedef struct _gc_additional_bufer gc_additional_buffer;
|
||||
|
||||
struct _gc_additional_bufer {
|
||||
uint32_t used;
|
||||
gc_additional_buffer *next;
|
||||
gc_root_buffer buf[GC_NUM_ADDITIONAL_ENTRIES];
|
||||
};
|
||||
|
||||
typedef struct _zend_gc_globals {
|
||||
zend_bool gc_enabled;
|
||||
zend_bool gc_active;
|
||||
@@ -93,6 +104,8 @@ typedef struct _zend_gc_globals {
|
||||
uint32_t zval_marked_grey;
|
||||
#endif
|
||||
|
||||
gc_additional_buffer *additional_buffer;
|
||||
|
||||
} zend_gc_globals;
|
||||
|
||||
#ifdef ZTS
|
||||
|
||||
@@ -310,6 +310,16 @@ static zend_always_inline int zend_hash_str_exists_ind(const HashTable *ht, cons
|
||||
Z_TYPE_P(Z_INDIRECT_P(zv)) != IS_UNDEF);
|
||||
}
|
||||
|
||||
static zend_always_inline zval *zend_symbtable_add_new(HashTable *ht, zend_string *key, zval *pData)
|
||||
{
|
||||
zend_ulong idx;
|
||||
|
||||
if (ZEND_HANDLE_NUMERIC(key, idx)) {
|
||||
return zend_hash_index_add_new(ht, idx, pData);
|
||||
} else {
|
||||
return zend_hash_add_new(ht, key, pData);
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline zval *zend_symtable_update(HashTable *ht, zend_string *key, zval *pData)
|
||||
{
|
||||
|
||||
+48
-19
@@ -926,8 +926,13 @@ ZEND_API int ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2) /* {
|
||||
} else if (!converted) {
|
||||
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_ADD, add_function);
|
||||
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
if (EXPECTED(op1 != op2)) {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
op2 = op1;
|
||||
}
|
||||
converted = 1;
|
||||
} else {
|
||||
zend_throw_error(NULL, "Unsupported operand types");
|
||||
@@ -979,8 +984,13 @@ ZEND_API int ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2) /* {
|
||||
} else if (!converted) {
|
||||
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_SUB, sub_function);
|
||||
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
if (EXPECTED(op1 != op2)) {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
op2 = op1;
|
||||
}
|
||||
converted = 1;
|
||||
} else {
|
||||
zend_throw_error(NULL, "Unsupported operand types");
|
||||
@@ -1026,8 +1036,13 @@ ZEND_API int ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2) /* {
|
||||
} else if (!converted) {
|
||||
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_MUL, mul_function);
|
||||
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
if (EXPECTED(op1 != op2)) {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
op2 = op1;
|
||||
}
|
||||
converted = 1;
|
||||
} else {
|
||||
zend_throw_error(NULL, "Unsupported operand types");
|
||||
@@ -1104,17 +1119,27 @@ ZEND_API int ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* {
|
||||
} else if (!converted) {
|
||||
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_POW, pow_function);
|
||||
|
||||
if (Z_TYPE_P(op1) == IS_ARRAY) {
|
||||
ZVAL_LONG(result, 0);
|
||||
return SUCCESS;
|
||||
if (EXPECTED(op1 != op2)) {
|
||||
if (Z_TYPE_P(op1) == IS_ARRAY) {
|
||||
ZVAL_LONG(result, 0);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
}
|
||||
if (Z_TYPE_P(op2) == IS_ARRAY) {
|
||||
ZVAL_LONG(result, 1L);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
}
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
}
|
||||
if (Z_TYPE_P(op2) == IS_ARRAY) {
|
||||
ZVAL_LONG(result, 1L);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
if (Z_TYPE_P(op1) == IS_ARRAY) {
|
||||
ZVAL_LONG(result, 0);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
}
|
||||
op2 = op1;
|
||||
}
|
||||
converted = 1;
|
||||
} else {
|
||||
@@ -1178,9 +1203,13 @@ ZEND_API int ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* {
|
||||
op2 = Z_REFVAL_P(op2);
|
||||
} else if (!converted) {
|
||||
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_DIV, div_function);
|
||||
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
if (EXPECTED(op1 != op2)) {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
zendi_convert_scalar_to_number(op2, op2_copy, result);
|
||||
} else {
|
||||
zendi_convert_scalar_to_number(op1, op1_copy, result);
|
||||
op2 = op1;
|
||||
}
|
||||
converted = 1;
|
||||
} else {
|
||||
zend_throw_error(NULL, "Unsupported operand types");
|
||||
|
||||
+13
-5
@@ -131,6 +131,12 @@
|
||||
|
||||
#if defined(HAVE_LIBDL) && !defined(ZEND_WIN32)
|
||||
|
||||
# if defined(__has_feature)
|
||||
# if __has_feature(address_sanitizer)
|
||||
# define __SANITIZE_ADDRESS__
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef RTLD_LAZY
|
||||
# define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
|
||||
# endif
|
||||
@@ -141,7 +147,7 @@
|
||||
|
||||
# if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT)
|
||||
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT)
|
||||
# elif defined(RTLD_DEEPBIND)
|
||||
# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__)
|
||||
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_DEEPBIND)
|
||||
# else
|
||||
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)
|
||||
@@ -239,11 +245,13 @@ char *alloca();
|
||||
# define ZEND_FASTCALL
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004
|
||||
#else
|
||||
# define __restrict__
|
||||
#ifndef restrict
|
||||
# if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004
|
||||
# else
|
||||
# define __restrict__
|
||||
# endif
|
||||
# define restrict __restrict__
|
||||
#endif
|
||||
#define restrict __restrict__
|
||||
|
||||
#if (defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)) || __has_attribute(noreturn)
|
||||
# define HAVE_NORETURN
|
||||
|
||||
+4
-3
@@ -912,9 +912,10 @@ static zend_always_inline uint32_t zval_delref_p(zval* pz) {
|
||||
|
||||
#define SEPARATE_STRING(zv) do { \
|
||||
zval *_zv = (zv); \
|
||||
if (Z_REFCOUNTED_P(_zv) && \
|
||||
Z_REFCOUNT_P(_zv) > 1) { \
|
||||
Z_DELREF_P(_zv); \
|
||||
if (Z_REFCOUNT_P(_zv) > 1) { \
|
||||
if (Z_REFCOUNTED_P(_zv)) { \
|
||||
Z_DELREF_P(_zv); \
|
||||
} \
|
||||
zval_copy_ctor_func(_zv); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
+11
-3
@@ -1376,8 +1376,11 @@ main() {
|
||||
dir = opendir("/");
|
||||
if (!dir)
|
||||
exit(1);
|
||||
if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0)
|
||||
if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0) {
|
||||
close(dir);
|
||||
exit(0);
|
||||
}
|
||||
close(dir);
|
||||
exit(1);
|
||||
}
|
||||
],[
|
||||
@@ -2334,13 +2337,15 @@ AC_DEFUN([PHP_SETUP_OPENSSL],[
|
||||
|
||||
dnl If pkg-config is found try using it
|
||||
if test "$PHP_OPENSSL_DIR" = "yes" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then
|
||||
if $PKG_CONFIG --atleast-version=0.9.8 openssl; then
|
||||
if $PKG_CONFIG --atleast-version=1.1 openssl; then
|
||||
AC_MSG_ERROR([OpenSSL version >= 1.1 is not supported.])
|
||||
elif $PKG_CONFIG --atleast-version=0.9.8 openssl; then
|
||||
found_openssl=yes
|
||||
OPENSSL_LIBS=`$PKG_CONFIG --libs openssl`
|
||||
OPENSSL_INCS=`$PKG_CONFIG --cflags-only-I openssl`
|
||||
OPENSSL_INCDIR=`$PKG_CONFIG --variable=includedir openssl`
|
||||
else
|
||||
AC_MSG_ERROR([OpenSSL version 0.9.8 or greater required.])
|
||||
AC_MSG_ERROR([OpenSSL version >= 0.9.8 and < 1.1 required.])
|
||||
fi
|
||||
|
||||
if test -n "$OPENSSL_LIBS"; then
|
||||
@@ -3109,3 +3114,6 @@ AC_DEFUN([PHP_CHECK_BUILTIN_CTZLL], [
|
||||
AC_DEFINE_UNQUOTED([PHP_HAVE_BUILTIN_CTZLL], [$have_builtin_ctzll], [Whether the compiler supports __builtin_ctzll])
|
||||
|
||||
])
|
||||
|
||||
dnl Load the AX_CHECK_COMPILE_FLAG macro from the autoconf archive.
|
||||
m4_include([build/ax_check_compile_flag.m4])
|
||||
@@ -17,9 +17,9 @@ if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
|
||||
set BRANCH=master
|
||||
set STABILITY=staging
|
||||
)
|
||||
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%PHP_SDK_VC%-%PHP_SDK_ARCH%-%APPVEYOR_REPO_BRANCH%
|
||||
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%PHP_SDK_VC%-%PHP_SDK_ARCH%-%BRANCH%
|
||||
rem SDK is cached, deps info is cached as well
|
||||
echo Updating dependencies
|
||||
echo Updating dependencies in %DEPS_DIR%
|
||||
call phpsdk_deps --update --branch %BRANCH% --stability %STABILITY% --deps %DEPS_DIR%
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
|
||||
@@ -4,7 +4,14 @@ set NO_INTERACTION=1
|
||||
set REPORT_EXIT_STATUS=1
|
||||
set SKIP_IO_CAPTURE_TESTS=1
|
||||
|
||||
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%PHP_SDK_VC%-%PHP_SDK_ARCH%-%APPVEYOR_REPO_BRANCH%
|
||||
if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
|
||||
set BRANCH=%APPVEYOR_REPO_BRANCH:~4,3%
|
||||
set STABILITY=stable
|
||||
) else (
|
||||
set BRANCH=master
|
||||
set STABILITY=staging
|
||||
)
|
||||
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%PHP_SDK_VC%-%PHP_SDK_ARCH%-%BRANCH%
|
||||
|
||||
rem setup MySQL related exts
|
||||
set MYSQL_PWD=Password12!
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether the given FLAG works with the current language's compiler
|
||||
# or gives an error. (Warnings, however, are ignored)
|
||||
#
|
||||
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||
# success/failure.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the current language's default
|
||||
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
|
||||
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
|
||||
# force the compiler to issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 4
|
||||
|
||||
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
|
||||
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
|
||||
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
|
||||
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
|
||||
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
|
||||
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
|
||||
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||
[AS_VAR_SET(CACHEVAR,[no])])
|
||||
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
|
||||
AS_VAR_IF(CACHEVAR,yes,
|
||||
[m4_default([$2], :)],
|
||||
[m4_default([$3], :)])
|
||||
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||
])dnl AX_CHECK_COMPILE_FLAGS
|
||||
+10
-10
@@ -69,33 +69,33 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
/* To enable the is_nan, is_infinite and is_finite PHP functions */
|
||||
#ifdef NETWARE
|
||||
#define HAVE_ISNAN 1
|
||||
#define HAVE_ISINF 1
|
||||
#define HAVE_ISFINITE 1
|
||||
#define HAVE_DECL_ISNAN 1
|
||||
#define HAVE_DECL_ISINF 1
|
||||
#define HAVE_DECL_ISFINITE 1
|
||||
#endif
|
||||
|
||||
#ifndef zend_isnan
|
||||
#ifdef HAVE_ISNAN
|
||||
#ifdef HAVE_DECL_ISNAN
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
#else
|
||||
#define zend_isnan(a) 0
|
||||
#define zend_isnan(a) ((a) != (a))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ISINF
|
||||
#ifdef HAVE_DECL_ISINF
|
||||
#define zend_isinf(a) isinf(a)
|
||||
#elif defined(INFINITY)
|
||||
/* Might not work, but is required by ISO C99 */
|
||||
#define zend_isinf(a) (((a)==INFINITY)?1:0)
|
||||
#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
|
||||
#else
|
||||
#define zend_isinf(a) 0
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_ISFINITE) || defined(isfinite)
|
||||
#if defined(HAVE_DECL_ISFINITE)
|
||||
#define zend_finite(a) isfinite(a)
|
||||
#elif defined(HAVE_FINITE)
|
||||
#define zend_finite(a) finite(a)
|
||||
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=7
|
||||
PHP_MINOR_VERSION=0
|
||||
PHP_RELEASE_VERSION=16
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=17
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ static void curlfile_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
||||
size_t fname_len, mime_len, postname_len;
|
||||
zval *cf = return_value;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ss", &fname, &fname_len, &mime, &mime_len, &postname, &postname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|ss", &fname, &fname_len, &mime, &mime_len, &postname, &postname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ var_dump(curl_setopt_array($c, [
|
||||
CURLOPT_UPLOAD => true,
|
||||
CURLOPT_INFILE => $f,
|
||||
CURLOPT_INFILESIZE => filesize(__FILE__),
|
||||
CURLOPT_CONNECTTIMEOUT => 1,
|
||||
CURLOPT_TIMEOUT => 1,
|
||||
CURLOPT_CONNECTTIMEOUT => 3,
|
||||
CURLOPT_TIMEOUT => 3,
|
||||
]));
|
||||
fclose($f);
|
||||
var_dump(curl_setopt_array($c, [
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
array curl_multi_info_read ( resource $mh [, int &$msgs_in_queue = NULL ] );
|
||||
--CREDITS--
|
||||
marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); }
|
||||
if (!extension_loaded('curl')) { print("skip"); }
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$urls = array(
|
||||
"bugs.php.net",
|
||||
"pear.php.net"
|
||||
);
|
||||
|
||||
$mh = curl_multi_init();
|
||||
foreach ($urls as $i => $url) {
|
||||
$conn[$i] = curl_init($url);
|
||||
curl_setopt($conn[$i], CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_multi_add_handle($mh, $conn[$i]);
|
||||
}
|
||||
|
||||
do {
|
||||
$status = curl_multi_exec($mh, $active);
|
||||
$info = curl_multi_info_read($mh);
|
||||
if (false !== $info) {
|
||||
var_dump(is_array($info));
|
||||
}
|
||||
} while ($status === CURLM_CALL_MULTI_PERFORM || $active);
|
||||
|
||||
foreach ($urls as $i => $url) {
|
||||
curl_close($conn[$i]);
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -33,9 +33,9 @@ function curl_cli_server_start() {
|
||||
|
||||
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
|
||||
// it might not be listening yet...need to wait until fsockopen() call returns
|
||||
$error = "Unable to connect to servers\n";
|
||||
$error = "Unable to connect to server\n";
|
||||
for ($i=0; $i < 60; $i++) {
|
||||
usleep(25000); // 25ms per try
|
||||
usleep(50000); // 50ms per try
|
||||
$status = proc_get_status($handle);
|
||||
$fp = @fsockopen(PHP_CURL_SERVER_HOSTNAME, PHP_CURL_SERVER_PORT);
|
||||
// Failure, the server is no longer running
|
||||
@@ -63,6 +63,14 @@ function curl_cli_server_start() {
|
||||
register_shutdown_function(
|
||||
function($handle) use($router) {
|
||||
proc_terminate($handle);
|
||||
/* Wait for server to shutdown */
|
||||
for ($i = 0; $i < 60; $i++) {
|
||||
$status = proc_get_status($handle);
|
||||
if (!($status && $status['running'])) {
|
||||
break;
|
||||
}
|
||||
usleep(50000);
|
||||
}
|
||||
},
|
||||
$handle
|
||||
);
|
||||
|
||||
@@ -154,7 +154,7 @@ static void do_adjust_for_weekday(timelib_time* time)
|
||||
{
|
||||
/* To make "this week" work, where the current DOW is a "sunday" */
|
||||
if (current_dow == 0 && time->relative.weekday != 0) {
|
||||
time->relative.weekday = -6;
|
||||
time->relative.weekday -= 7;
|
||||
}
|
||||
|
||||
/* To make "sunday this week" work, where the current DOW is not a
|
||||
@@ -354,7 +354,7 @@ static timelib_sll do_years(timelib_sll year)
|
||||
return res;
|
||||
}
|
||||
|
||||
static timelib_sll do_months(timelib_ull month, timelib_ull year)
|
||||
static timelib_sll do_months(timelib_ull month, timelib_sll year)
|
||||
{
|
||||
if (timelib_is_leap(year)) {
|
||||
return ((month_tab_leap[month - 1] + 1) * SECS_PER_DAY);
|
||||
@@ -463,7 +463,7 @@ void timelib_update_ts(timelib_time* time, timelib_tzinfo* tzi)
|
||||
time->sse = res;
|
||||
|
||||
time->sse_uptodate = 1;
|
||||
time->have_relative = time->relative.have_weekday_relative = time->relative.have_special_relative = 0;
|
||||
time->have_relative = time->relative.have_weekday_relative = time->relative.have_special_relative = time->relative.first_last_day_of = 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -189,6 +189,7 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
|
||||
|
||||
timelib_unixtime2gmt(tm, ts - (tm->z * 60) + (tm->dst * 3600));
|
||||
|
||||
tm->sse = ts;
|
||||
tm->z = z;
|
||||
tm->dst = dst;
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #72719: Relative datetime format ignores weekday on sundays only
|
||||
--FILE--
|
||||
<?php
|
||||
echo (new DateTimeImmutable('Monday next week 13:00'))->format('l'), "\n";
|
||||
echo (new DateTimeImmutable('Tuesday next week 14:00'))->format('l'), "\n";
|
||||
echo (new DateTimeImmutable('Wednesday next week 14:00'))->format('l'), "\n";
|
||||
echo (new DateTimeImmutable('Thursday next week 15:00'))->format('l'), "\n";
|
||||
echo (new DateTimeImmutable('Friday next week 16:00'))->format('l'), "\n";
|
||||
echo (new DateTimeImmutable('Saturday next week 17:00'))->format('l'), "\n";
|
||||
echo (new DateTimeImmutable('Sunday next week 18:00'))->format('l'), "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Monday
|
||||
Tuesday
|
||||
Wednesday
|
||||
Thursday
|
||||
Friday
|
||||
Saturday
|
||||
Sunday
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #73294: DateTime wrong when date string is negative
|
||||
--FILE--
|
||||
<?php
|
||||
for ( $i = -1050; $i <= -1000; $i++ )
|
||||
{
|
||||
$M = "06";
|
||||
$D = "22";
|
||||
|
||||
$dt = new DateTime("{$i}-{$M}-{$D} 00:00:00");
|
||||
$expected = "{$i}-{$M}-{$D} 00:00:00";
|
||||
$result = $dt->format('Y-m-d H:i:s');
|
||||
|
||||
if ( $expected != $result )
|
||||
{
|
||||
echo "Wrong: Should have been {$expected}, was {$result}\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
==DONE==
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #73489: wrong timestamp when call setTimeZone multi times with UTC offset
|
||||
--FILE--
|
||||
<?php
|
||||
// example 1 - Timestamp is changing
|
||||
$datetime = new DateTime('2016-11-09 20:00:00', new DateTimeZone('UTC'));
|
||||
var_dump($datetime->getTimestamp());
|
||||
$datetime->setTimeZone(new DateTimeZone('-03:00'));
|
||||
$datetime->setTimeZone(new DateTimeZone('-03:00'));
|
||||
var_dump($datetime->getTimestamp());
|
||||
|
||||
// example 2 - Timestamp keeps if you use getTimestamp() before second setTimeZone() calls
|
||||
$datetime = new DateTime('2016-11-09 20:00:00', new DateTimeZone('UTC'));
|
||||
var_dump($datetime->getTimestamp());
|
||||
$datetime->setTimeZone(new DateTimeZone('-03:00'));
|
||||
$datetime->getTimestamp();
|
||||
$datetime->setTimeZone(new DateTimeZone('-03:00'));
|
||||
var_dump($datetime->getTimestamp());
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1478721600)
|
||||
int(1478721600)
|
||||
int(1478721600)
|
||||
int(1478721600)
|
||||
@@ -0,0 +1,63 @@
|
||||
--TEST--
|
||||
Bug #73858: diff() of two relative/described DateTimes is wrong
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
In the "verbose setup method" I'm trying setup the DateTime object myself
|
||||
to see if it's the format string which is parsed in correctly or if it's the DateTime
|
||||
object which is breaking stuff. From the testing it appears DateTime is broken somehow.
|
||||
*/
|
||||
$ss = 'february first day of last month midnight';
|
||||
$es = 'february first day of this month midnight - 1 second';
|
||||
|
||||
$s = new DateTime($ss);
|
||||
$e = new DateTime($es);
|
||||
$d= $e->diff($s);
|
||||
var_dump($d->days); // 0 ... but should be 30
|
||||
|
||||
$s = (new DateTime(null))->setTimestamp(strtotime($ss)); // verbose setup method
|
||||
$e = (new DateTime(null))->setTimestamp(strtotime($es)); // verbose setup method
|
||||
$d = $e->diff($s);
|
||||
var_dump($d->days); // 30 ... and should be 30
|
||||
|
||||
/*
|
||||
Next we will try mix/match the code to see what happens, surprisingly it seems that the end date ($e)
|
||||
is the important one, if it uses the verbose method it returns the correct values.
|
||||
*/
|
||||
$s = (new DateTime(null))->setTimestamp(strtotime($ss)); // verbose setup method
|
||||
$e = new DateTime($es);
|
||||
$d= $e->diff($s);
|
||||
var_dump($d->days); // 0 ... but should be 30
|
||||
|
||||
$s = new DateTime($ss);
|
||||
$e = (new DateTime(null))->setTimestamp(strtotime($es)); // verbose setup method
|
||||
$d= $e->diff($s);
|
||||
var_dump($d->days); // 30 ... and should be 30
|
||||
|
||||
/*
|
||||
This test just proves that the $e date is important BUT NOT because it's the one we call the diff() method
|
||||
on, that's just coincidental that seems to imply that the "- 1 second" in the date string is the problem.
|
||||
*/
|
||||
$s = new DateTime($ss);
|
||||
$e = (new DateTime(null))->setTimestamp(strtotime($es)); // verbose setup method
|
||||
$d= $s->diff($e);
|
||||
var_dump($d->days); // 30 ... and should be 30
|
||||
|
||||
/*
|
||||
[Workaround]
|
||||
This final test seems to prove that the input string is important and that the "- 1 secord" has a negative knock-on
|
||||
effect on the results of the diff. By modifying the datetime with ->modify everything works as expected ...
|
||||
it just means you have to be careful of how we work with DateTimes .
|
||||
*/
|
||||
$s = new DateTime($ss);
|
||||
$e = new DateTime('february first day of this month midnight');
|
||||
$e->modify('- 1 second');
|
||||
var_dump($e->diff($s)->days); // 30 ... and should be 30
|
||||
?>
|
||||
--EXPECT--
|
||||
int(30)
|
||||
int(30)
|
||||
int(30)
|
||||
int(30)
|
||||
int(30)
|
||||
int(30)
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #73942: $date->modify('Friday this week') doesn't return a Friday if $date is a Sunday
|
||||
--FILE--
|
||||
<?php
|
||||
$date1 = "2017-01-08"; // this is a Sunday
|
||||
$date = new \DateTime($date1);
|
||||
$date->modify('Friday this week');
|
||||
$dateFormat = $date->format('Y-m-d');
|
||||
echo $dateFormat, "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
2017-01-06
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #74057: wrong day when using "this week" in strtotime
|
||||
--FILE--
|
||||
<?php
|
||||
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Sun 2017-01-01")))."\n";
|
||||
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Mon 2017-01-02")))."\n";
|
||||
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Tue 2017-01-03")))."\n";
|
||||
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Wed 2017-01-04")))."\n";
|
||||
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Thu 2017-01-05")))."\n";
|
||||
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Fri 2017-01-06")))."\n";
|
||||
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Sat 2017-01-07")))."\n";
|
||||
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Sun 2017-01-08")))."\n";
|
||||
echo date("D Y-m-d", strtotime("saturday this week", strtotime("Mon 2017-01-09")))."\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Sat 2016-12-31
|
||||
Sat 2017-01-07
|
||||
Sat 2017-01-07
|
||||
Sat 2017-01-07
|
||||
Sat 2017-01-07
|
||||
Sat 2017-01-07
|
||||
Sat 2017-01-07
|
||||
Sat 2017-01-07
|
||||
Sat 2017-01-14
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Test invalid time zone passed to ini_set
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
ini_set("date.timezone", "Incorrect/Zone");
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ini_set(): Invalid date.timezone value 'Incorrect/Zone', we selected the timezone 'UTC' for now. in %sini_set_incorrect.php on line %d
|
||||
+1
-1
@@ -213,7 +213,7 @@ Since: DOM Level 3
|
||||
*/
|
||||
int dom_attr_schema_type_info_read(dom_object *obj, zval *retval)
|
||||
{
|
||||
php_error_docref(NULL, E_WARNING, "Not yet implemented");
|
||||
/* TODO */
|
||||
ZVAL_NULL(retval);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
+28
-4
@@ -921,7 +921,7 @@ Since: DOM Level 2
|
||||
PHP_FUNCTION(dom_element_get_attribute_node_ns)
|
||||
{
|
||||
zval *id;
|
||||
xmlNodePtr elemp;
|
||||
xmlNodePtr elemp, fakeAttrp;
|
||||
xmlAttrPtr attrp;
|
||||
dom_object *intern;
|
||||
size_t uri_len, name_len;
|
||||
@@ -937,10 +937,34 @@ PHP_FUNCTION(dom_element_get_attribute_node_ns)
|
||||
attrp = xmlHasNsProp(elemp, (xmlChar *)name, (xmlChar *)uri);
|
||||
|
||||
if (attrp == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
if (xmlStrEqual((xmlChar *) uri, (xmlChar *)DOM_XMLNS_NAMESPACE)) {
|
||||
xmlNsPtr nsptr;
|
||||
nsptr = dom_get_nsdecl(elemp, (xmlChar *)name);
|
||||
if (nsptr != NULL) {
|
||||
xmlNsPtr curns;
|
||||
curns = xmlNewNs(NULL, nsptr->href, NULL);
|
||||
if (nsptr->prefix) {
|
||||
curns->prefix = xmlStrdup((xmlChar *) nsptr->prefix);
|
||||
}
|
||||
if (nsptr->prefix) {
|
||||
fakeAttrp = xmlNewDocNode(elemp->doc, NULL, (xmlChar *) nsptr->prefix, nsptr->href);
|
||||
} else {
|
||||
fakeAttrp = xmlNewDocNode(elemp->doc, NULL, (xmlChar *)"xmlns", nsptr->href);
|
||||
}
|
||||
fakeAttrp->type = XML_NAMESPACE_DECL;
|
||||
fakeAttrp->parent = elemp;
|
||||
fakeAttrp->ns = curns;
|
||||
|
||||
DOM_RET_OBJ((xmlNodePtr) attrp, &ret, intern);
|
||||
DOM_RET_OBJ(fakeAttrp, &ret, intern);
|
||||
} else {
|
||||
RETURN_NULL();
|
||||
}
|
||||
} else {
|
||||
RETURN_NULL();
|
||||
}
|
||||
} else {
|
||||
DOM_RET_OBJ((xmlNodePtr) attrp, &ret, intern);
|
||||
}
|
||||
|
||||
}
|
||||
/* }}} end dom_element_get_attribute_node_ns */
|
||||
|
||||
+2
-1
@@ -549,7 +549,8 @@ int dom_node_next_sibling_read(dom_object *obj, zval *retval)
|
||||
|
||||
nextsib = nodep->next;
|
||||
if (!nextsib) {
|
||||
return FAILURE;
|
||||
ZVAL_NULL(retval);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
php_dom_create_object(nextsib, retval, obj);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #54382 DOMNode::getAttributeNodeNS doesn't get xmlns* attributes
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$xmlString = '<?xml version="1.0" encoding="utf-8" ?>
|
||||
<root xmlns="http://ns" xmlns:ns2="http://ns2">
|
||||
<ns2:child />
|
||||
</root>';
|
||||
|
||||
$xml=new DOMDocument();
|
||||
$xml->loadXML($xmlString);
|
||||
$de = $xml->documentElement;
|
||||
|
||||
$ns2 = $de->getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "ns2");
|
||||
if ($ns2 == NULL) {
|
||||
echo 'namespace node does not exist.' . "\n";
|
||||
} else {
|
||||
echo 'namespace node prefix=' . $ns2->prefix . "\n";
|
||||
echo 'namespace node namespaceURI=' . $ns2->namespaceURI . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
namespace node prefix=ns2
|
||||
namespace node namespaceURI=http://ns2
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #61858 DOMAttr debug info generates E_WARNING
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadXML('<example a="b">Test</example>');
|
||||
|
||||
$example = $doc->getElementsByTagName('example')->item(0);
|
||||
$attr = $example->getAttributeNode('a');
|
||||
|
||||
var_dump($attr);
|
||||
print_r($attr);
|
||||
--EXPECTF--
|
||||
object(DOMAttr)#%d (%d) {
|
||||
%A
|
||||
}
|
||||
DOMAttr Object
|
||||
(
|
||||
%A
|
||||
)
|
||||
@@ -31,7 +31,7 @@ foreach ($dataNodes AS $node) {
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
int(3)
|
||||
object(DOMText)#%d (18) {
|
||||
object(DOMText)#%d (19) {
|
||||
["wholeText"]=>
|
||||
string(3) "
|
||||
"
|
||||
@@ -57,6 +57,8 @@ object(DOMText)#%d (18) {
|
||||
NULL
|
||||
["previousSibling"]=>
|
||||
NULL
|
||||
["nextSibling"]=>
|
||||
NULL
|
||||
["attributes"]=>
|
||||
NULL
|
||||
["ownerDocument"]=>
|
||||
@@ -73,7 +75,7 @@ object(DOMText)#%d (18) {
|
||||
string(3) "
|
||||
"
|
||||
}
|
||||
object(DOMElement)#%d (17) {
|
||||
object(DOMElement)#%d (18) {
|
||||
["tagName"]=>
|
||||
string(5) "form1"
|
||||
["schemaTypeInfo"]=>
|
||||
@@ -98,6 +100,8 @@ object(DOMElement)#%d (17) {
|
||||
string(22) "(object value omitted)"
|
||||
["previousSibling"]=>
|
||||
NULL
|
||||
["nextSibling"]=>
|
||||
NULL
|
||||
["attributes"]=>
|
||||
string(22) "(object value omitted)"
|
||||
["ownerDocument"]=>
|
||||
@@ -117,7 +121,7 @@ object(DOMElement)#%d (17) {
|
||||
Value C
|
||||
"
|
||||
}
|
||||
object(DOMText)#%d (18) {
|
||||
object(DOMText)#%d (19) {
|
||||
["wholeText"]=>
|
||||
string(1) "
|
||||
"
|
||||
@@ -143,6 +147,8 @@ object(DOMText)#%d (18) {
|
||||
NULL
|
||||
["previousSibling"]=>
|
||||
NULL
|
||||
["nextSibling"]=>
|
||||
NULL
|
||||
["attributes"]=>
|
||||
NULL
|
||||
["ownerDocument"]=>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #73907 nextSibling property not included in var_dump of DOMNode
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$xmlString = '<?xml version="1.0" encoding="utf-8" ?>
|
||||
<root>
|
||||
</root>';
|
||||
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadXML($xmlString);
|
||||
$attr = $doc->documentElement;
|
||||
|
||||
var_dump($attr);
|
||||
--EXPECTF--
|
||||
object(DOMElement)#%d (%d) {%A
|
||||
["nextSibling"]=>
|
||||
NULL
|
||||
%A}
|
||||
@@ -2,8 +2,6 @@
|
||||
Test: setAttributeNode()
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--INI--
|
||||
error_reporting = E_ALL & ~E_WARNING
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ DOMDocument Object
|
||||
[firstChild] => (object value omitted)
|
||||
[lastChild] => (object value omitted)
|
||||
[previousSibling] =>
|
||||
[nextSibling] =>
|
||||
[attributes] =>
|
||||
[ownerDocument] =>
|
||||
[namespaceURI] =>
|
||||
|
||||
+1
-1
@@ -4203,7 +4203,7 @@ PHP_FUNCTION(exif_imagetype)
|
||||
php_stream * stream;
|
||||
int itype = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &imagefile, &imagefile_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &imagefile, &imagefile_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,23 +142,23 @@ Warning: exif_imagetype(0.5): failed to open stream: No such file or directory i
|
||||
bool(false)
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d
|
||||
Warning: exif_imagetype() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d
|
||||
Warning: exif_imagetype() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d
|
||||
Warning: exif_imagetype() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d
|
||||
Warning: exif_imagetype() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d
|
||||
Warning: exif_imagetype() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 15 --
|
||||
|
||||
@@ -198,7 +198,7 @@ Warning: exif_imagetype(obj'ct): failed to open stream: No such file or director
|
||||
bool(false)
|
||||
-- Iteration 24 --
|
||||
|
||||
Warning: exif_imagetype() expects parameter 1 to be string, resource given in %s on line %d
|
||||
Warning: exif_imagetype() expects parameter 1 to be a valid path, resource given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 25 --
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ $context = stream_context_create(array('ssl' => array('local_cert' => dirname(__
|
||||
|
||||
for ($i=0; $i<10 && !$socket; ++$i) {
|
||||
$port = rand(50000, 65535);
|
||||
|
||||
$socket = stream_socket_server("tcp://127.0.0.1:$port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
|
||||
|
||||
$socket = @stream_socket_server("tcp://127.0.0.1:$port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
|
||||
}
|
||||
//set anther random port that is not the same as $port
|
||||
do{
|
||||
@@ -15,6 +15,7 @@ do{
|
||||
}while($pasv_port == $port);
|
||||
|
||||
if (!$socket) {
|
||||
echo "$errstr ($errno)\n";
|
||||
die("could not start/bind the ftp server\n");
|
||||
}
|
||||
|
||||
@@ -401,20 +402,34 @@ if ($pid) {
|
||||
|
||||
}elseif (preg_match('/^PASV/', $buf, $matches)) {
|
||||
$pasv=true;
|
||||
$p2 = $pasv_port % ((int) 1 << 8);
|
||||
$p1 = ($pasv_port-$p2)/((int) 1 << 8);
|
||||
$host = "127.0.0.1";
|
||||
if (!empty($ssl)) {
|
||||
$soc = stream_socket_server("tcp://127.0.0.1:$pasv_port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
|
||||
} else {
|
||||
$soc = stream_socket_server("tcp://127.0.0.1:$pasv_port");
|
||||
$i=0;
|
||||
|
||||
do {
|
||||
if (!empty($ssl)) {
|
||||
$soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
|
||||
} else {
|
||||
$soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port");
|
||||
}
|
||||
/* Could bind port, Try another port */
|
||||
if (!$soc) {
|
||||
$pasv_port = rand(50000, 65535);
|
||||
}
|
||||
$i++;
|
||||
} while ($i<10 && !$soc);
|
||||
|
||||
if (!$soc) {
|
||||
echo "$errstr ($errno)\n";
|
||||
die("could not bind passive port\n");
|
||||
}
|
||||
|
||||
$p2 = $pasv_port % ((int) 1 << 8);
|
||||
$p1 = ($pasv_port-$p2)/((int) 1 << 8);
|
||||
fputs($s, "227 Entering Passive Mode. (127,0,0,1,{$p1},{$p2})\r\n");
|
||||
|
||||
$pasvs = stream_socket_accept($soc,10);
|
||||
|
||||
}elseif (preg_match('/^EPSV/', $buf, $matches)) {
|
||||
} elseif (preg_match('/^EPSV/', $buf, $matches)) {
|
||||
fputs($s, "550 Extended passsive mode not supported.\r\n");
|
||||
} elseif (preg_match('/^SITE EXEC/', $buf, $matches)) {
|
||||
fputs($s, "200 OK\r\n");
|
||||
|
||||
@@ -368,6 +368,8 @@ ZEND_END_ARG_INFO()
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_imagepng, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, im)
|
||||
ZEND_ARG_INFO(0, filename)
|
||||
ZEND_ARG_INFO(0, quality)
|
||||
ZEND_ARG_INFO(0, filters)
|
||||
ZEND_END_ARG_INFO()
|
||||
#endif
|
||||
|
||||
|
||||
+2
-2
@@ -152,7 +152,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else {
|
||||
ctx = emalloc(sizeof(gdIOCtx));
|
||||
ctx = ecalloc(1, sizeof(gdIOCtx));
|
||||
ctx->putC = _php_image_output_putc;
|
||||
ctx->putBuf = _php_image_output_putbuf;
|
||||
ctx->gd_free = _php_image_output_ctxfree;
|
||||
@@ -165,7 +165,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
}
|
||||
|
||||
if (!ctx) {
|
||||
ctx = emalloc(sizeof(gdIOCtx));
|
||||
ctx = ecalloc(1, sizeof(gdIOCtx));
|
||||
ctx->putC = _php_image_stream_putc;
|
||||
ctx->putBuf = _php_image_stream_putbuf;
|
||||
if (close_stream) {
|
||||
|
||||
@@ -693,8 +693,6 @@ void gdImageCopyResampled(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, in
|
||||
gdImagePtr gdImageRotate90(gdImagePtr src, int ignoretransparent);
|
||||
gdImagePtr gdImageRotate180(gdImagePtr src, int ignoretransparent);
|
||||
gdImagePtr gdImageRotate270(gdImagePtr src, int ignoretransparent);
|
||||
gdImagePtr gdImageRotate45(gdImagePtr src, double dAngle, int clrBack, int ignoretransparent);
|
||||
gdImagePtr gdImageRotate (gdImagePtr src, double dAngle, int clrBack, int ignoretransparent);
|
||||
gdImagePtr gdImageRotateInterpolated(const gdImagePtr src, const float angle, int bgcolor);
|
||||
|
||||
void gdImageSetBrush(gdImagePtr im, gdImagePtr brush);
|
||||
|
||||
+10
-2
@@ -136,6 +136,10 @@ static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, in
|
||||
GD2_DBG(php_gd_error("%d Chunks vertically", *ncy));
|
||||
|
||||
if (gd2_compressed(*fmt)) {
|
||||
if (*ncx <= 0 || *ncy <= 0 || *ncx > INT_MAX / *ncy) {
|
||||
GD2_DBG(printf ("Illegal chunk counts: %d * %d\n", *ncx, *ncy));
|
||||
goto fail1;
|
||||
}
|
||||
nc = (*ncx) * (*ncy);
|
||||
GD2_DBG(php_gd_error("Reading %d chunk index entries", nc));
|
||||
if (overflow2(sizeof(t_chunk_info), nc)) {
|
||||
@@ -340,12 +344,16 @@ gdImagePtr gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
|
||||
for (x = xlo; x < xhi; x++) {
|
||||
if (im->trueColor) {
|
||||
if (!gdGetInt(&im->tpixels[y][x], in)) {
|
||||
im->tpixels[y][x] = 0;
|
||||
php_gd_error("gd2: EOF while reading\n");
|
||||
gdImageDestroy(im);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
int ch;
|
||||
if (!gdGetByte(&ch, in)) {
|
||||
ch = 0;
|
||||
php_gd_error("gd2: EOF while reading\n");
|
||||
gdImageDestroy(im);
|
||||
return NULL;
|
||||
}
|
||||
im->pixels[y][x] = ch;
|
||||
}
|
||||
|
||||
@@ -343,218 +343,3 @@ gdImagePtr gdImageRotate270 (gdImagePtr src, int ignoretransparent)
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageRotate45 (gdImagePtr src, double dAngle, int clrBack, int ignoretransparent)
|
||||
{
|
||||
typedef int (*FuncPtr)(gdImagePtr, int, int);
|
||||
gdImagePtr dst1,dst2,dst3;
|
||||
FuncPtr f;
|
||||
double dRadAngle, dSinE, dTan, dShear;
|
||||
double dOffset; /* Variable skew offset */
|
||||
int u, iShear, newx, newy;
|
||||
int clrBackR, clrBackG, clrBackB, clrBackA;
|
||||
|
||||
/* See GEMS I for the algorithm details */
|
||||
dRadAngle = dAngle * ROTATE_DEG2RAD; /* Angle in radians */
|
||||
dSinE = sin (dRadAngle);
|
||||
dTan = tan (dRadAngle / 2.0);
|
||||
|
||||
newx = (int)(src->sx + src->sy * fabs(dTan));
|
||||
newy = src->sy;
|
||||
|
||||
/* 1st shear */
|
||||
if (src->trueColor) {
|
||||
f = gdImageGetTrueColorPixel;
|
||||
} else {
|
||||
f = gdImageGetPixel;
|
||||
}
|
||||
|
||||
dst1 = gdImageCreateTrueColor(newx, newy);
|
||||
/******* Perform 1st shear (horizontal) ******/
|
||||
if (dst1 == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
#ifdef HAVE_GD_BUNDLED
|
||||
dst1->alphaBlendingFlag = gdEffectReplace;
|
||||
#else
|
||||
gdImageAlphaBlending(dst1, 0);
|
||||
#endif
|
||||
if (dAngle == 0.0) {
|
||||
/* Returns copy of src */
|
||||
gdImageCopy (dst1, src,0,0,0,0,src->sx,src->sy);
|
||||
return dst1;
|
||||
}
|
||||
|
||||
gdImagePaletteCopy (dst1, src);
|
||||
|
||||
if (ignoretransparent) {
|
||||
if (gdImageTrueColor(src)) {
|
||||
dst1->transparent = src->transparent;
|
||||
} else {
|
||||
|
||||
dst1->transparent = gdTrueColorAlpha(gdImageRed(src, src->transparent), gdImageBlue(src, src->transparent), gdImageGreen(src, src->transparent), 127);
|
||||
}
|
||||
}
|
||||
|
||||
dRadAngle = dAngle * ROTATE_DEG2RAD; /* Angle in radians */
|
||||
dSinE = sin (dRadAngle);
|
||||
dTan = tan (dRadAngle / 2.0);
|
||||
|
||||
for (u = 0; u < dst1->sy; u++) {
|
||||
if (dTan >= 0.0) {
|
||||
dShear = ((double)(u + 0.5)) * dTan;
|
||||
} else {
|
||||
dShear = ((double)(u - dst1->sy) + 0.5) * dTan;
|
||||
}
|
||||
|
||||
iShear = (int)floor(dShear);
|
||||
gdImageSkewX(dst1, src, u, iShear, (dShear - iShear), clrBack, ignoretransparent);
|
||||
}
|
||||
|
||||
/*
|
||||
The 1st shear may use the original clrBack as color index
|
||||
Convert it once here
|
||||
*/
|
||||
if(!src->trueColor) {
|
||||
clrBackR = gdImageRed(src, clrBack);
|
||||
clrBackG = gdImageGreen(src, clrBack);
|
||||
clrBackB = gdImageBlue(src, clrBack);
|
||||
clrBackA = gdImageAlpha(src, clrBack);
|
||||
clrBack = gdTrueColorAlpha(clrBackR, clrBackG, clrBackB, clrBackA);
|
||||
}
|
||||
/* 2nd shear */
|
||||
newx = dst1->sx;
|
||||
|
||||
if (dSinE > 0.0) {
|
||||
dOffset = (src->sx-1) * dSinE;
|
||||
} else {
|
||||
dOffset = -dSinE * (src->sx - newx);
|
||||
}
|
||||
|
||||
newy = (int) ((double) src->sx * fabs( dSinE ) + (double) src->sy * cos (dRadAngle))+1;
|
||||
|
||||
if (src->trueColor) {
|
||||
f = gdImageGetTrueColorPixel;
|
||||
} else {
|
||||
f = gdImageGetPixel;
|
||||
}
|
||||
dst2 = gdImageCreateTrueColor(newx, newy);
|
||||
if (dst2 == NULL) {
|
||||
gdImageDestroy(dst1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GD_BUNDLED
|
||||
dst2->alphaBlendingFlag = gdEffectReplace;
|
||||
#else
|
||||
gdImageAlphaBlending(dst2, 0);
|
||||
#endif
|
||||
|
||||
if (ignoretransparent) {
|
||||
dst2->transparent = dst1->transparent;
|
||||
}
|
||||
|
||||
for (u = 0; u < dst2->sx; u++, dOffset -= dSinE) {
|
||||
iShear = (int)floor (dOffset);
|
||||
gdImageSkewY(dst2, dst1, u, iShear, (dOffset - (double)iShear), clrBack, ignoretransparent);
|
||||
}
|
||||
|
||||
/* 3rd shear */
|
||||
gdImageDestroy(dst1);
|
||||
|
||||
newx = (int) ((double)src->sy * fabs (dSinE) + (double)src->sx * cos (dRadAngle)) + 1;
|
||||
newy = dst2->sy;
|
||||
|
||||
if (src->trueColor) {
|
||||
f = gdImageGetTrueColorPixel;
|
||||
} else {
|
||||
f = gdImageGetPixel;
|
||||
}
|
||||
dst3 = gdImageCreateTrueColor(newx, newy);
|
||||
if (dst3 == NULL) {
|
||||
gdImageDestroy(dst2);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GD_BUNDLED
|
||||
dst3->alphaBlendingFlag = gdEffectReplace;
|
||||
#else
|
||||
gdImageAlphaBlending(dst3, 0);
|
||||
#endif
|
||||
|
||||
if (ignoretransparent) {
|
||||
dst3->transparent = dst2->transparent;
|
||||
}
|
||||
|
||||
if (dSinE >= 0.0) {
|
||||
dOffset = (double)(src->sx - 1) * dSinE * -dTan;
|
||||
} else {
|
||||
dOffset = dTan * ((double)(src->sx - 1) * -dSinE + (double)(1 - newy));
|
||||
}
|
||||
|
||||
for (u = 0; u < dst3->sy; u++, dOffset += dTan) {
|
||||
int iShear = (int)floor(dOffset);
|
||||
gdImageSkewX(dst3, dst2, u, iShear, (dOffset - iShear), clrBack, ignoretransparent);
|
||||
}
|
||||
|
||||
gdImageDestroy(dst2);
|
||||
|
||||
return dst3;
|
||||
}
|
||||
|
||||
gdImagePtr gdImageRotate (gdImagePtr src, double dAngle, int clrBack, int ignoretransparent)
|
||||
{
|
||||
gdImagePtr pMidImg;
|
||||
gdImagePtr rotatedImg;
|
||||
|
||||
if (src == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!gdImageTrueColor(src) && (clrBack < 0 || clrBack>=gdImageColorsTotal(src))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (dAngle >= 360.0) {
|
||||
dAngle -= 360.0;
|
||||
}
|
||||
|
||||
while (dAngle < 0) {
|
||||
dAngle += 360.0;
|
||||
}
|
||||
|
||||
if (dAngle == 90.00) {
|
||||
return gdImageRotate90(src, ignoretransparent);
|
||||
}
|
||||
if (dAngle == 180.00) {
|
||||
return gdImageRotate180(src, ignoretransparent);
|
||||
}
|
||||
if(dAngle == 270.00) {
|
||||
return gdImageRotate270 (src, ignoretransparent);
|
||||
}
|
||||
|
||||
if ((dAngle > 45.0) && (dAngle <= 135.0)) {
|
||||
pMidImg = gdImageRotate90 (src, ignoretransparent);
|
||||
dAngle -= 90.0;
|
||||
} else if ((dAngle > 135.0) && (dAngle <= 225.0)) {
|
||||
pMidImg = gdImageRotate180 (src, ignoretransparent);
|
||||
dAngle -= 180.0;
|
||||
} else if ((dAngle > 225.0) && (dAngle <= 315.0)) {
|
||||
pMidImg = gdImageRotate270 (src, ignoretransparent);
|
||||
dAngle -= 270.0;
|
||||
} else {
|
||||
return gdImageRotate45 (src, dAngle, clrBack, ignoretransparent);
|
||||
}
|
||||
|
||||
if (pMidImg == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rotatedImg = gdImageRotate45 (pMidImg, dAngle, clrBack, ignoretransparent);
|
||||
gdImageDestroy(pMidImg);
|
||||
|
||||
return rotatedImg;
|
||||
}
|
||||
/* End Rotate function */
|
||||
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ gdImagePtr gdImageCreateFromXbm(FILE * fd)
|
||||
max_bit = 32768;
|
||||
}
|
||||
if (max_bit) {
|
||||
bytes = (width * height / 8) + 1;
|
||||
bytes = (width + 7) / 8 * height;
|
||||
if (!bytes) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
--TEST--
|
||||
Bug #47946 (ImageConvolution overwrites background)
|
||||
--DESCRIPTION--
|
||||
The expected image has black pixel artifacts, what is another issue, though
|
||||
(perhaps #40158).
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
function array_flatten($array)
|
||||
{
|
||||
$tempArray = array();
|
||||
|
||||
foreach ($array as $value) {
|
||||
if (is_array($value)) {
|
||||
$tempArray = array_merge($tempArray, array_flatten($value));
|
||||
} else {
|
||||
$tempArray[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $tempArray;
|
||||
}
|
||||
|
||||
function makeFilter($resource, $matrix, $offset = 1.0)
|
||||
{
|
||||
$divisor = array_sum(array_flatten($matrix));
|
||||
if ($divisor == 0) {
|
||||
$divisor = .01;
|
||||
}
|
||||
return imageconvolution($resource, $matrix, $divisor, $offset);
|
||||
}
|
||||
|
||||
$edgeMatrix = array(array(1, 0, 1), array(0, 5, 0), array(1, 0, 1));
|
||||
|
||||
$im = imagecreatetruecolor(40, 40);
|
||||
imagealphablending($im, false);
|
||||
imagefilledrectangle($im, 0, 0, 39, 39, 0x7fffffff);
|
||||
imagefilledellipse($im, 19, 19, 20, 20, 0x00ff00);
|
||||
imagesavealpha($im, true);
|
||||
makeFilter($im, $edgeMatrix);
|
||||
|
||||
require_once __DIR__ . '/func.inc';
|
||||
test_image_equals_file(__DIR__ . '/bug47946_exp.png', $im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images are equal.
|
||||
===DONE===
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 396 B |
Binary file not shown.
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug 73868 (DOS vulnerability in gdImageCreateFromGd2Ctx())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73868.gd2'));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: imagecreatefromgd2(): gd2: EOF while reading
|
||||
in %s on line %d
|
||||
|
||||
Warning: imagecreatefromgd2(): '%s' is not a valid GD2 file in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #73869 (Signed Integer Overflow gd_io.c)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73869a.gd2'));
|
||||
var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73869b.gd2'));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: imagecreatefromgd2(): '%s' is not a valid GD2 file in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: imagecreatefromgd2(): '%s' is not a valid GD2 file in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #73968 (Premature failing of XBM reading)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatefromxbm(__DIR__ . DIRECTORY_SEPARATOR . 'bug73968.xbm');
|
||||
var_dump($im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
resource(%d) of type (gd)
|
||||
===DONE===
|
||||
@@ -0,0 +1,5 @@
|
||||
#define test_width 10
|
||||
#define test_height 10
|
||||
static unsigned char test_bits[] = {
|
||||
0xFF, 0x03, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00,
|
||||
0xFF, 0x03, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00};
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
(Bug #74031) ReflectionFunction for imagepng returns wrong number of parameters
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$ref = new ReflectionFunction('imagepng');
|
||||
var_dump(count($ref->getParameters()));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(4)
|
||||
@@ -11,9 +11,6 @@ $im = imagecreatefromxbm(dirname(__FILE__) . '/libgd00094.xbm');
|
||||
var_dump($im);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imagecreatefromxbm(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
|
||||
in %slibgd00094.php on line %d
|
||||
|
||||
Warning: imagecreatefromxbm(): '%slibgd00094.xbm' is not a valid XBM file in %slibgd00094.php on line %d
|
||||
bool(false)
|
||||
|
||||
@@ -3,8 +3,11 @@ PHP_ARG_WITH(gmp, for GNU MP support,
|
||||
|
||||
if test "$PHP_GMP" != "no"; then
|
||||
|
||||
MACHINE_INCLUDES=$($CC -dumpmachine)
|
||||
|
||||
for i in $PHP_GMP /usr/local /usr; do
|
||||
test -f $i/include/gmp.h && GMP_DIR=$i && break
|
||||
test -f $i/include/$MACHINE_INCLUDES/gmp.h && GMP_DIR=$i && break
|
||||
done
|
||||
|
||||
if test -z "$GMP_DIR"; then
|
||||
|
||||
+1
-1
@@ -783,7 +783,7 @@ static void php_hash_dtor(zend_resource *rsrc) /* {{{ */
|
||||
}
|
||||
|
||||
if (hash->key) {
|
||||
memset(hash->key, 0, hash->ops->block_size);
|
||||
ZEND_SECURE_ZERO(hash->key, hash->ops->block_size);
|
||||
efree(hash->key);
|
||||
}
|
||||
efree(hash);
|
||||
|
||||
@@ -227,14 +227,13 @@ static inline void Gost(PHP_GOST_CTX *context, php_hash_uint32 data[8])
|
||||
static inline void GostTransform(PHP_GOST_CTX *context, const unsigned char input[32])
|
||||
{
|
||||
int i, j;
|
||||
php_hash_uint32 data[8], temp = 0, save = 0;
|
||||
php_hash_uint32 data[8], temp = 0;
|
||||
|
||||
for (i = 0, j = 0; i < 8; ++i, j += 4) {
|
||||
data[i] = ((php_hash_uint32) input[j]) | (((php_hash_uint32) input[j + 1]) << 8) |
|
||||
(((php_hash_uint32) input[j + 2]) << 16) | (((php_hash_uint32) input[j + 3]) << 24);
|
||||
save = context->state[i + 8];
|
||||
context->state[i + 8] += data[i] + temp;
|
||||
temp = ((context->state[i + 8] < data[i]) || (context->state[i + 8] < save)) ? 1 : 0;
|
||||
temp = context->state[i + 8] < data[i] ? 1 : (context->state[i + 8] == data[i] ? temp : 0);
|
||||
}
|
||||
|
||||
Gost(context, data);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #73127 (gost-crypto hash incorrect if input data contains long 0xFF sequence)
|
||||
--FILE--
|
||||
<?php // $Id$
|
||||
|
||||
$test1 = str_repeat("\xFF", 40);
|
||||
$test2 = str_repeat("\x00", 40);
|
||||
echo hash('gost-crypto', $test1),
|
||||
"\n",
|
||||
hash('gost', $test1),
|
||||
"\n",
|
||||
hash('gost-crypto', $test2),
|
||||
"\n",
|
||||
hash('gost', $test2),
|
||||
"\n",
|
||||
hash('gost-crypto', ''),
|
||||
"\n",
|
||||
hash('gost', '')
|
||||
;
|
||||
?>
|
||||
--EXPECT--
|
||||
231d8bb980d3faa30fee6ec475df5669cf6c24bbce22f46d6737470043a99f8e
|
||||
9eaf96ba62f90fae6707f1d4274d1a9d6680f5a121d4387815aa3a6ec42439c5
|
||||
bbf1f3179409c853cd3e396d67b0e10a266c218a4fd19f149c39aa4f6d37a007
|
||||
a0be0b90fea5a5b50c90c9429d07bb98fa0c06f0c30210e94c7d80c3125c67ac
|
||||
981e5f3ca30c841487830f84fb433e13ac1101569b9c13584ac483234cd656c0
|
||||
ce85b99cc46752fffee35cab9a7b0278abb4c2d2055cff685af4912c49490f8d
|
||||
+1
-1
@@ -86,7 +86,7 @@ if test "$PHP_INTL" != "no"; then
|
||||
breakiterator/codepointiterator_methods.cpp \
|
||||
uchar/uchar.c \
|
||||
idn/idn.c \
|
||||
$icu_spoof_src, $ext_shared,,$ICU_INCS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
|
||||
$icu_spoof_src, $ext_shared,,$ICU_INCS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,cxx)
|
||||
PHP_ADD_BUILD_DIR($ext_builddir/collator)
|
||||
PHP_ADD_BUILD_DIR($ext_builddir/converter)
|
||||
PHP_ADD_BUILD_DIR($ext_builddir/common)
|
||||
|
||||
+5
-2
@@ -1427,7 +1427,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
|
||||
zend_ulong index;
|
||||
int is_full_add=0; /* flag for full add operation so ldap_mod_add can be put back into oper, gerrit THomson */
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa", &link, &dn, &dn_len, &entry) != SUCCESS) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/", &link, &dn, &dn_len, &entry) != SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1475,6 +1475,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
|
||||
if (Z_TYPE_P(value) != IS_ARRAY) {
|
||||
num_values = 1;
|
||||
} else {
|
||||
SEPARATE_ARRAY(value);
|
||||
num_values = zend_hash_num_elements(Z_ARRVAL_P(value));
|
||||
}
|
||||
|
||||
@@ -1680,7 +1681,7 @@ PHP_FUNCTION(ldap_modify_batch)
|
||||
);
|
||||
*/
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa", &link, &dn, &dn_len, &mods) != SUCCESS) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/", &link, &dn, &dn_len, &mods) != SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1725,6 +1726,7 @@ PHP_FUNCTION(ldap_modify_batch)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
SEPARATE_ARRAY(mod);
|
||||
/* for the modification hashtable... */
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(mod));
|
||||
num_modprops = zend_hash_num_elements(Z_ARRVAL_P(mod));
|
||||
@@ -1799,6 +1801,7 @@ PHP_FUNCTION(ldap_modify_batch)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
SEPARATE_ARRAY(modinfo);
|
||||
/* is the array not empty? */
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(modinfo));
|
||||
num_modvals = zend_hash_num_elements(Z_ARRVAL_P(modinfo));
|
||||
|
||||
@@ -1,3 +1,74 @@
|
||||
To ease testing LDAP-Setups we've created a vagrant-setup.
|
||||
|
||||
Prerequisits:
|
||||
=============
|
||||
|
||||
You will need vagrant on your box. Get it from https://www.vagrantup.com
|
||||
|
||||
Usage:
|
||||
======
|
||||
|
||||
To use it follow these steps:
|
||||
|
||||
* Create a Vagrant-file with the following content.
|
||||
* Go to that directory and run "vagrant up"
|
||||
|
||||
```
|
||||
$setup = <<<SETUP
|
||||
apt-get update
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive aptitude install -q -y slapd ldap-utils
|
||||
|
||||
export SLAPPASS=`slappasswd -s password`
|
||||
|
||||
echo "dn: olcDatabase={1}hdb,cn=config
|
||||
changetype: modify
|
||||
replace: olcSuffix
|
||||
olcSuffix: dc=nodomain
|
||||
-
|
||||
replace: olcRootDN
|
||||
olcRootDN: dc=admin,dc=nodomain
|
||||
-
|
||||
replace: olcRootPW
|
||||
olcRootPW: ${SLAPPASS}" | ldapmodify -Y EXTERNAL -H ldapi:///
|
||||
|
||||
echo "dn: dc=nodomain
|
||||
objectClass: dcObject
|
||||
objectClass: organization
|
||||
o: Example
|
||||
dc: example
|
||||
|
||||
dn: ou=extldap,dc=nodomain
|
||||
objectClass: organizationalUnit
|
||||
ou: extldap" | ldapadd -c -x -H ldap://localhost:389 -D "dc=admin,dc=nodomain" -w password
|
||||
SETUP
|
||||
|
||||
Vagrant.configure(2) do |config|
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
config.vm.network "private_network", ip: "192.168.33.10"
|
||||
config.vm.provision "shell", inline: $setup
|
||||
end
|
||||
```
|
||||
|
||||
Now you will have a virtual machine up and running on IP-Address 192.168.10.33 listening on port 369 for incomming LDAP-connections. The machine is already configured to execute the LDAP-Tests
|
||||
|
||||
The next step is to go into the PHP-Source-directory. Configure and make the source as appropriate.
|
||||
|
||||
Before running the LDAP-Tests you need to set some environment-variables:
|
||||
|
||||
export LDAP_TEST_PASSWD="password"
|
||||
export LDAP_TEST_BASE="ou=extldap,dc=nodomain"
|
||||
export LDAP_TEST_USER="dc=admin,dc=nodomain"
|
||||
export LDAP_TEST_HOST=192.168.33.10
|
||||
|
||||
Now you can run the test-suite by calling "make test". To test only the LDAP-Tests, run "make test TESTS=ext/ldap"
|
||||
|
||||
CAVEAT: The current setup does not (yet) test secure connections.
|
||||
|
||||
|
||||
========
|
||||
OLD README
|
||||
|
||||
Most tests here relies on the availability of an LDAP server configured with TLS.
|
||||
|
||||
Client/Server configuration:
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Bug #73933 (error/segfault with ldap_mod_replace and opcache)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* We are assuming 3333 is not connectable */
|
||||
$ldap = ldap_connect('127.0.0.1', 3333);
|
||||
|
||||
ldap_mod_replace($ldap, null, array(
|
||||
'lockoutTime' => array(0),
|
||||
));
|
||||
|
||||
ldap_modify_batch($ldap, null, array( [
|
||||
"attrib" => "mail",
|
||||
"modtype" => LDAP_MODIFY_BATCH_ADD,
|
||||
"values" => [
|
||||
"test@example.com",
|
||||
"test-2@example.com", ]]));
|
||||
|
||||
|
||||
ldap_close($ldap);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ldap_mod_replace(): Modify: Can't contact LDAP server in %sbug73933.php on line %d
|
||||
|
||||
Warning: ldap_modify_batch(): Batch Modify: Can't contact LDAP server in %sbug73933.php on line %d
|
||||
+3
-1
@@ -572,7 +572,9 @@ PHP_FUNCTION(mcrypt_generic_init)
|
||||
memcpy(key_s, key, key_len);
|
||||
|
||||
if (iv_len != iv_size) {
|
||||
php_error_docref(NULL, E_WARNING, "Iv size incorrect; supplied length: %zd, needed: %d", iv_len, iv_size);
|
||||
if (mcrypt_enc_mode_has_iv(pm->td)) {
|
||||
php_error_docref(NULL, E_WARNING, "Iv size incorrect; supplied length: %zd, needed: %d", iv_len, iv_size);
|
||||
}
|
||||
if (iv_len > iv_size) {
|
||||
iv_len = iv_size;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Bug #67707 IV not needed for ECB encryption mode, but it returns a warning
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$td = mcrypt_module_open('rijndael-256', '', 'ecb', '');
|
||||
mcrypt_generic_init($td, 'secret key', NULL);
|
||||
?>
|
||||
--EXPECTF--
|
||||
+1
-3
@@ -1324,9 +1324,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
|
||||
} else {
|
||||
zval_ptr_dtor(&retval);
|
||||
}
|
||||
if (fci.params) {
|
||||
efree(fci.params);
|
||||
}
|
||||
zend_fcall_info_args_clear(&fci, 1);
|
||||
} else if (ctor_params) {
|
||||
zend_throw_exception_ex(zend_ce_exception, 0, "Class %s does not have a constructor hence you cannot use ctor_params", ZSTR_VAL(ce->name));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Bug #69899: Segfault on stmt close after free_result with mysqlnd.
|
||||
--DESCRIPTION--
|
||||
The segfault happens only if the database connection was already closed and
|
||||
free_result is called on a prepared statement followed by closing that
|
||||
statement. This is due to mysqlnd_stmt::free_result (mysqlnd_ps.c) which
|
||||
unconditionally sets the connection of the statement to ready, despite the fact
|
||||
that it might already be closed.
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once __DIR__ . '/skipif.inc';
|
||||
require_once __DIR__ . '/skipifconnectfailure.inc';
|
||||
require_once __DIR__ . '/connect.inc';
|
||||
if (!$IS_MYSQLND) {
|
||||
die('mysqlnd only');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/connect.inc';
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
|
||||
$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||
$stmt = $mysqli->prepare('SELECT 1');
|
||||
|
||||
var_dump(
|
||||
$mysqli->close(),
|
||||
$stmt->free_result(),
|
||||
$stmt->close()
|
||||
);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
NULL
|
||||
bool(true)
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #73800 (sporadic segfault with MYSQLI_OPT_INT_AND_FLOAT_NATIVE)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
if (PHP_INT_SIZE != 8) die('skip requires 64-bit');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once("connect.inc");
|
||||
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||
|
||||
$link->query('SET @@global.max_allowed_packet = 67108864');
|
||||
$link->close();
|
||||
|
||||
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||
$link->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1);
|
||||
|
||||
$res = $link->query("SELECT RPAD('1',9000000,'1') as a,RPAD('1',9000000,'1') as b, 9223372036854775807 as c");
|
||||
$r = $res->fetch_array();
|
||||
|
||||
var_dump($r['c']);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(9223372036854775807)
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #73949 (leak in mysqli_fetch_object)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifemb.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
|
||||
class cc{
|
||||
function __construct($c=null){
|
||||
}
|
||||
};
|
||||
$i=mysqli_connect('p:'.$host, $user, $passwd, $db);
|
||||
$res=mysqli_query($i, "SHOW STATUS LIKE 'Connections'");
|
||||
$t=array(new stdClass);
|
||||
while($db= mysqli_fetch_object($res,'cc',$t)){}
|
||||
print "done!";
|
||||
?>
|
||||
--EXPECTF--
|
||||
done!
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #74021 (fetch_array broken data. Data more then MEDIUMBLOB)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once("connect.inc");
|
||||
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||
|
||||
$link->query('SET @@global.max_allowed_packet = 67108864');
|
||||
$link->close();
|
||||
|
||||
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||
$res = $link->query("SELECT RPAD('1',9000000,'1') as a,RPAD('1',9000000,'1') as b");
|
||||
$r = $res->fetch_array();
|
||||
var_dump(md5($r['a']));
|
||||
var_dump(md5($r['b']));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(32) "42ca0fd16ab6b6d4b9d47dc0a4a8b12a"
|
||||
string(32) "42ca0fd16ab6b6d4b9d47dc0a4a8b12a"
|
||||
@@ -2005,8 +2005,9 @@ MYSQLND_METHOD(mysqlnd_stmt, free_result)(MYSQLND_STMT * const s)
|
||||
stmt->state = MYSQLND_STMT_PREPARED;
|
||||
}
|
||||
|
||||
/* Line is free! */
|
||||
CONN_SET_STATE(stmt->conn, CONN_READY);
|
||||
if (CONN_GET_STATE(stmt->conn) != CONN_QUIT_SENT) {
|
||||
CONN_SET_STATE(stmt->conn, CONN_READY);
|
||||
}
|
||||
|
||||
DBG_RETURN(PASS);
|
||||
}
|
||||
|
||||
@@ -1458,7 +1458,7 @@ php_mysqlnd_read_row_ex(MYSQLND_CONN_DATA * conn, MYSQLND_MEMORY_POOL * result_s
|
||||
zero-length byte, don't read the body, there is no such.
|
||||
*/
|
||||
|
||||
*data_size = prealloc_more_bytes;
|
||||
*data_size = 0;
|
||||
while (1) {
|
||||
if (FAIL == mysqlnd_read_header(conn->net, &header, conn->stats, conn->error_info)) {
|
||||
ret = FAIL;
|
||||
@@ -1469,7 +1469,8 @@ php_mysqlnd_read_row_ex(MYSQLND_CONN_DATA * conn, MYSQLND_MEMORY_POOL * result_s
|
||||
|
||||
if (first_iteration) {
|
||||
first_iteration = FALSE;
|
||||
*buffer = result_set_memory_pool->get_chunk(result_set_memory_pool, *data_size);
|
||||
*buffer = result_set_memory_pool->get_chunk(
|
||||
result_set_memory_pool, *data_size + prealloc_more_bytes);
|
||||
if (!*buffer) {
|
||||
ret = FAIL;
|
||||
break;
|
||||
@@ -1484,7 +1485,7 @@ php_mysqlnd_read_row_ex(MYSQLND_CONN_DATA * conn, MYSQLND_MEMORY_POOL * result_s
|
||||
/*
|
||||
We have to realloc the buffer.
|
||||
*/
|
||||
if (FAIL == (*buffer)->resize_chunk((*buffer), *data_size)) {
|
||||
if (FAIL == (*buffer)->resize_chunk((*buffer), *data_size + prealloc_more_bytes)) {
|
||||
SET_OOM_ERROR(*conn->error_info);
|
||||
ret = FAIL;
|
||||
break;
|
||||
@@ -1507,7 +1508,6 @@ php_mysqlnd_read_row_ex(MYSQLND_CONN_DATA * conn, MYSQLND_MEMORY_POOL * result_s
|
||||
(*buffer)->free_chunk((*buffer));
|
||||
*buffer = NULL;
|
||||
}
|
||||
*data_size -= prealloc_more_bytes;
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -561,6 +561,17 @@ static void zend_rebuild_access_path(zend_cfg *cfg, zend_op_array *op_array, int
|
||||
convert_to_string((v)); \
|
||||
}
|
||||
|
||||
static int is_predecessor_smart_branch(zend_op *start, zend_op *predecessor) {
|
||||
do {
|
||||
if (predecessor == start) {
|
||||
return 0;
|
||||
}
|
||||
predecessor--;
|
||||
} while (predecessor->opcode == ZEND_NOP);
|
||||
|
||||
return zend_is_smart_branch(predecessor);
|
||||
}
|
||||
|
||||
static void strip_nop(zend_code_block *block, zend_op_array *op_array, zend_optimizer_ctx *ctx)
|
||||
{
|
||||
zend_op *opline = block->start_opline;
|
||||
@@ -602,8 +613,7 @@ static void strip_nop(zend_code_block *block, zend_op_array *op_array, zend_opti
|
||||
&& ((opline + 1)->opcode == ZEND_JMPZ
|
||||
|| (opline + 1)->opcode == ZEND_JMPNZ)
|
||||
&& (opline + 1)->op1_type & (IS_CV|IS_CONST)
|
||||
&& opline > op_array->opcodes
|
||||
&& zend_is_smart_branch(opline - 1)) {
|
||||
&& is_predecessor_smart_branch(op_array->opcodes, opline)) {
|
||||
/* don't remove NOP, that splits incorrect smart branch */
|
||||
opline++;
|
||||
break;
|
||||
|
||||
@@ -406,12 +406,26 @@ int zend_optimizer_replace_by_const(zend_op_array *op_array,
|
||||
break;
|
||||
/* In most cases IS_TMP_VAR operand may be used only once.
|
||||
* The operands are usually destroyed by the opcode handler.
|
||||
* ZEND_CASE is an exception, that keeps operand unchanged,
|
||||
* and allows its reuse. The number of ZEND_CASE instructions
|
||||
* ZEND_CASE and ZEND_FETCH_LIST are exceptions, they keeps operand
|
||||
* unchanged, and allows its reuse. these instructions
|
||||
* usually terminated by ZEND_FREE that finally kills the value.
|
||||
*/
|
||||
case ZEND_FREE:
|
||||
case ZEND_CASE: {
|
||||
case ZEND_FETCH_LIST: {
|
||||
zend_op *m = opline;
|
||||
do {
|
||||
if (m->opcode == ZEND_FETCH_LIST &&
|
||||
ZEND_OP1_TYPE(m) == type &&
|
||||
ZEND_OP1(m).var == var) {
|
||||
zend_optimizer_update_op1_const(op_array, m, val);
|
||||
}
|
||||
m++;
|
||||
} while (m->opcode != ZEND_FREE || ZEND_OP1_TYPE(m) != type || ZEND_OP1(m).var != var);
|
||||
ZEND_ASSERT(m->opcode == ZEND_FREE && ZEND_OP1_TYPE(m) == type && ZEND_OP1(m).var == var);
|
||||
MAKE_NOP(m);
|
||||
return 1;
|
||||
}
|
||||
case ZEND_CASE:
|
||||
case ZEND_FREE: {
|
||||
zend_op *m, *n;
|
||||
int brk = op_array->last_brk_cont;
|
||||
zend_bool in_switch = 0;
|
||||
|
||||
@@ -118,6 +118,8 @@ static zend_string *(*accelerator_orig_zend_resolve_path)(const char *filename,
|
||||
static void (*orig_chdir)(INTERNAL_FUNCTION_PARAMETERS) = NULL;
|
||||
static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL;
|
||||
|
||||
static void accel_gen_system_id(void);
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
# define INCREMENT(v) InterlockedIncrement64(&ZCSG(v))
|
||||
# define DECREMENT(v) InterlockedDecrement64(&ZCSG(v))
|
||||
@@ -2541,6 +2543,9 @@ static void accel_globals_ctor(zend_accel_globals *accel_globals)
|
||||
ZEND_TSRMLS_CACHE_UPDATE();
|
||||
#endif
|
||||
memset(accel_globals, 0, sizeof(zend_accel_globals));
|
||||
|
||||
/* TODO refactor to init this just once. */
|
||||
accel_gen_system_id();
|
||||
}
|
||||
|
||||
static void accel_globals_internal_func_dtor(zval *zv)
|
||||
@@ -2921,11 +2926,18 @@ void accel_shutdown(void)
|
||||
|
||||
void zend_accel_schedule_restart(zend_accel_restart_reason reason)
|
||||
{
|
||||
const char *zend_accel_restart_reason_text[ACCEL_RESTART_USER + 1] = {
|
||||
"out of memory",
|
||||
"hash overflow",
|
||||
"user",
|
||||
};
|
||||
|
||||
if (ZCSG(restart_pending)) {
|
||||
/* don't schedule twice */
|
||||
return;
|
||||
}
|
||||
zend_accel_error(ACCEL_LOG_DEBUG, "Restart Scheduled!");
|
||||
zend_accel_error(ACCEL_LOG_DEBUG, "Restart Scheduled! Reason: %s",
|
||||
zend_accel_restart_reason_text[reason]);
|
||||
|
||||
SHM_UNPROTECT();
|
||||
ZCSG(restart_pending) = 1;
|
||||
|
||||
@@ -95,6 +95,9 @@ static char *get_mmap_base_file(void)
|
||||
GetTempPath(MAXPATHLEN, windir);
|
||||
GetUserName(uname, &unsize);
|
||||
l = strlen(windir);
|
||||
if ('\\' == windir[l-1]) {
|
||||
l--;
|
||||
}
|
||||
snprintf(windir + l, sizeof(windir) - l - 1, "\\%s@%s@%.32s", ACCEL_FILEMAP_BASE, uname, ZCG(system_id));
|
||||
return windir;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #74019 (Segfault with list)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
public function seg() {
|
||||
list($a, $b) = A::CONSTS;
|
||||
var_dump($a, $b);
|
||||
return;
|
||||
}
|
||||
const CONSTS = [1, 2];
|
||||
}
|
||||
|
||||
$a = new A;
|
||||
$a->seg();
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(2)
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #74152 (if statement says true to a null variable)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$foo = 'foo';
|
||||
|
||||
$bar = null;
|
||||
|
||||
switch ($foo) {
|
||||
default:
|
||||
case 'foo':
|
||||
if ($bar) {
|
||||
echo 'true';
|
||||
} else {
|
||||
echo 'false';
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
false
|
||||
@@ -23,9 +23,9 @@ function php_cli_server_start($ini = "") {
|
||||
|
||||
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
|
||||
// it might not be listening yet...need to wait until fsockopen() call returns
|
||||
$error = "Unable to connect to servers\n";
|
||||
$error = "Unable to connect to server\n";
|
||||
for ($i=0; $i < 60; $i++) {
|
||||
usleep(25000); // 25ms per try
|
||||
usleep(50000); // 50ms per try
|
||||
$status = proc_get_status($handle);
|
||||
$fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT);
|
||||
// Failure, the server is no longer running
|
||||
@@ -53,6 +53,14 @@ function php_cli_server_start($ini = "") {
|
||||
register_shutdown_function(
|
||||
function($handle) {
|
||||
proc_terminate($handle);
|
||||
/* Wait for server to shutdown */
|
||||
for ($i = 0; $i < 60; $i++) {
|
||||
$status = proc_get_status($handle);
|
||||
if (!($status && $status['running'])) {
|
||||
break;
|
||||
}
|
||||
usleep(50000);
|
||||
}
|
||||
},
|
||||
$handle
|
||||
);
|
||||
|
||||
@@ -14,7 +14,11 @@ opcache.log_verbosity_level=4
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Foo Bar\n";
|
||||
opcache_reset();
|
||||
echo "Opcache reset";
|
||||
?>
|
||||
--EXPECTF--
|
||||
%s Message Cached script '%sbasic_logging%s'
|
||||
Foo Bar
|
||||
%s Debug Restart Scheduled! Reason: user
|
||||
Opcache reset
|
||||
@@ -33,6 +33,18 @@
|
||||
#define zend_accel_memdup(p, size) \
|
||||
_zend_shared_memdup((void*)p, size, 0)
|
||||
|
||||
#ifdef HAVE_OPCACHE_FILE_CACHE
|
||||
#define zend_set_str_gc_flags(str) do { \
|
||||
if (ZCG(accel_directives).file_cache_only) { \
|
||||
GC_FLAGS(str) = IS_STR_INTERNED; \
|
||||
} else { \
|
||||
GC_FLAGS(str) = IS_STR_INTERNED | IS_STR_PERMANENT; \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define zend_set_str_gc_flags(str) GC_FLAGS(str) = IS_STR_INTERNED | IS_STR_PERMANENT
|
||||
#endif
|
||||
|
||||
#define zend_accel_store_string(str) do { \
|
||||
zend_string *new_str = zend_shared_alloc_get_xlat_entry(str); \
|
||||
if (new_str) { \
|
||||
@@ -43,13 +55,13 @@
|
||||
zend_string_release(str); \
|
||||
str = new_str; \
|
||||
zend_string_hash_val(str); \
|
||||
GC_FLAGS(str) = IS_STR_INTERNED | IS_STR_PERMANENT; \
|
||||
zend_set_str_gc_flags(str); \
|
||||
} \
|
||||
} while (0)
|
||||
#define zend_accel_memdup_string(str) do { \
|
||||
str = zend_accel_memdup(str, _ZSTR_STRUCT_SIZE(ZSTR_LEN(str))); \
|
||||
zend_string_hash_val(str); \
|
||||
GC_FLAGS(str) = IS_STR_INTERNED | IS_STR_PERMANENT; \
|
||||
zend_set_str_gc_flags(str); \
|
||||
} while (0)
|
||||
#define zend_accel_store_interned_string(str) do { \
|
||||
if (!IS_ACCEL_INTERNED(str)) { \
|
||||
|
||||
+83
-45
@@ -667,9 +667,9 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
|
||||
}
|
||||
|
||||
for (i = 0; i < X509_NAME_entry_count(name); i++) {
|
||||
unsigned char *to_add;
|
||||
unsigned char *to_add = NULL;
|
||||
int to_add_len = 0;
|
||||
|
||||
int needs_free = 0;
|
||||
|
||||
ne = X509_NAME_get_entry(name, i);
|
||||
obj = X509_NAME_ENTRY_get_object(ne);
|
||||
@@ -683,8 +683,11 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
|
||||
|
||||
str = X509_NAME_ENTRY_get_data(ne);
|
||||
if (ASN1_STRING_type(str) != V_ASN1_UTF8STRING) {
|
||||
/* ASN1_STRING_to_UTF8(3): The converted data is copied into a newly allocated buffer */
|
||||
to_add_len = ASN1_STRING_to_UTF8(&to_add, str);
|
||||
needs_free = 1;
|
||||
} else {
|
||||
/* ASN1_STRING_data(3): Since this is an internal pointer it should not be freed or modified in any way */
|
||||
to_add = ASN1_STRING_data(str);
|
||||
to_add_len = ASN1_STRING_length(str);
|
||||
}
|
||||
@@ -703,7 +706,13 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
|
||||
add_assoc_stringl(&subitem, sname, (char *)to_add, to_add_len);
|
||||
}
|
||||
}
|
||||
|
||||
if (needs_free) {
|
||||
/* ASN1_STRING_to_UTF8(3): The buffer out should be freed using free(3) */
|
||||
OPENSSL_free(to_add);
|
||||
}
|
||||
}
|
||||
|
||||
if (key != NULL) {
|
||||
zend_hash_str_update(Z_ARRVAL_P(val), key, strlen(key), &subitem);
|
||||
}
|
||||
@@ -2004,6 +2013,10 @@ PHP_FUNCTION(openssl_x509_parse)
|
||||
char *extname;
|
||||
BIO *bio_out;
|
||||
BUF_MEM *bio_buf;
|
||||
ASN1_INTEGER *asn1_serial;
|
||||
BIGNUM *bn_serial;
|
||||
char *str_serial;
|
||||
char *hex_serial;
|
||||
char buf[256];
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &zcert, &useshortnames) == FAILURE) {
|
||||
@@ -2031,7 +2044,28 @@ PHP_FUNCTION(openssl_x509_parse)
|
||||
add_assoc_name_entry(return_value, "issuer", X509_get_issuer_name(cert), useshortnames);
|
||||
add_assoc_long(return_value, "version", X509_get_version(cert));
|
||||
|
||||
add_assoc_string(return_value, "serialNumber", i2s_ASN1_INTEGER(NULL, X509_get_serialNumber(cert)));
|
||||
asn1_serial = X509_get_serialNumber(cert);
|
||||
|
||||
bn_serial = ASN1_INTEGER_to_BN(asn1_serial, NULL);
|
||||
/* Can return NULL on error or memory allocation failure */
|
||||
if (!bn_serial) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
hex_serial = BN_bn2hex(bn_serial);
|
||||
BN_free(bn_serial);
|
||||
/* Can return NULL on error or memory allocation failure */
|
||||
if (!hex_serial) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
str_serial = i2s_ASN1_INTEGER(NULL, asn1_serial);
|
||||
add_assoc_string(return_value, "serialNumber", str_serial);
|
||||
OPENSSL_free(str_serial);
|
||||
|
||||
/* Return the hex representation of the serial number, as defined by OpenSSL */
|
||||
add_assoc_string(return_value, "serialNumberHex", hex_serial);
|
||||
OPENSSL_free(hex_serial);
|
||||
|
||||
add_assoc_asn1_string(return_value, "validFrom", X509_get_notBefore(cert));
|
||||
add_assoc_asn1_string(return_value, "validTo", X509_get_notAfter(cert));
|
||||
@@ -2604,56 +2638,60 @@ PHP_FUNCTION(openssl_pkcs12_read)
|
||||
zval_dtor(zout);
|
||||
array_init(zout);
|
||||
|
||||
bio_out = BIO_new(BIO_s_mem());
|
||||
if (PEM_write_bio_X509(bio_out, cert)) {
|
||||
BUF_MEM *bio_buf;
|
||||
BIO_get_mem_ptr(bio_out, &bio_buf);
|
||||
ZVAL_STRINGL(&zcert, bio_buf->data, bio_buf->length);
|
||||
add_assoc_zval(zout, "cert", &zcert);
|
||||
}
|
||||
BIO_free(bio_out);
|
||||
|
||||
bio_out = BIO_new(BIO_s_mem());
|
||||
if (PEM_write_bio_PrivateKey(bio_out, pkey, NULL, NULL, 0, 0, NULL)) {
|
||||
BUF_MEM *bio_buf;
|
||||
BIO_get_mem_ptr(bio_out, &bio_buf);
|
||||
ZVAL_STRINGL(&zpkey, bio_buf->data, bio_buf->length);
|
||||
add_assoc_zval(zout, "pkey", &zpkey);
|
||||
}
|
||||
BIO_free(bio_out);
|
||||
|
||||
array_init(&zextracerts);
|
||||
|
||||
for (i=0;;i++) {
|
||||
zval zextracert;
|
||||
X509* aCA = sk_X509_pop(ca);
|
||||
if (!aCA) break;
|
||||
|
||||
/* fix for bug 69882 */
|
||||
{
|
||||
int err = ERR_peek_error();
|
||||
if (err == OPENSSL_ERROR_X509_PRIVATE_KEY_VALUES_MISMATCH) {
|
||||
ERR_get_error();
|
||||
}
|
||||
}
|
||||
|
||||
if (cert) {
|
||||
bio_out = BIO_new(BIO_s_mem());
|
||||
if (PEM_write_bio_X509(bio_out, aCA)) {
|
||||
if (PEM_write_bio_X509(bio_out, cert)) {
|
||||
BUF_MEM *bio_buf;
|
||||
BIO_get_mem_ptr(bio_out, &bio_buf);
|
||||
ZVAL_STRINGL(&zextracert, bio_buf->data, bio_buf->length);
|
||||
add_index_zval(&zextracerts, i, &zextracert);
|
||||
|
||||
ZVAL_STRINGL(&zcert, bio_buf->data, bio_buf->length);
|
||||
add_assoc_zval(zout, "cert", &zcert);
|
||||
}
|
||||
BIO_free(bio_out);
|
||||
|
||||
X509_free(aCA);
|
||||
}
|
||||
if(ca) {
|
||||
|
||||
if (pkey) {
|
||||
bio_out = BIO_new(BIO_s_mem());
|
||||
if (PEM_write_bio_PrivateKey(bio_out, pkey, NULL, NULL, 0, 0, NULL)) {
|
||||
BUF_MEM *bio_buf;
|
||||
BIO_get_mem_ptr(bio_out, &bio_buf);
|
||||
ZVAL_STRINGL(&zpkey, bio_buf->data, bio_buf->length);
|
||||
add_assoc_zval(zout, "pkey", &zpkey);
|
||||
}
|
||||
BIO_free(bio_out);
|
||||
}
|
||||
|
||||
if (ca && sk_X509_num(ca)) {
|
||||
|
||||
array_init(&zextracerts);
|
||||
|
||||
for (i=0; i < sk_X509_num(ca); i++) {
|
||||
zval zextracert;
|
||||
X509* aCA = sk_X509_pop(ca);
|
||||
if (!aCA) break;
|
||||
|
||||
/* fix for bug 69882 */
|
||||
{
|
||||
int err = ERR_peek_error();
|
||||
if (err == OPENSSL_ERROR_X509_PRIVATE_KEY_VALUES_MISMATCH) {
|
||||
ERR_get_error();
|
||||
}
|
||||
}
|
||||
|
||||
bio_out = BIO_new(BIO_s_mem());
|
||||
if (PEM_write_bio_X509(bio_out, aCA)) {
|
||||
BUF_MEM *bio_buf;
|
||||
BIO_get_mem_ptr(bio_out, &bio_buf);
|
||||
ZVAL_STRINGL(&zextracert, bio_buf->data, bio_buf->length);
|
||||
add_index_zval(&zextracerts, i, &zextracert);
|
||||
|
||||
}
|
||||
BIO_free(bio_out);
|
||||
|
||||
X509_free(aCA);
|
||||
}
|
||||
|
||||
sk_X509_free(ca);
|
||||
add_assoc_zval(zout, "extracerts", &zextracerts);
|
||||
} else {
|
||||
zval_dtor(&zextracerts);
|
||||
}
|
||||
|
||||
RETVAL_TRUE;
|
||||
|
||||
Loaded 100 of 207 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user