mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-18 06:26:37 +00:00
Compare commits
254
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee18603649 | ||
|
|
f143587095 | ||
|
|
f27457e056 | ||
|
|
57101a3dd7 | ||
|
|
0c2649011d | ||
|
|
c526fa2d7b | ||
|
|
4488c43757 | ||
|
|
1250c4ee43 | ||
|
|
3c06794e93 | ||
|
|
8e48895f48 | ||
|
|
2ebd1c4e86 | ||
|
|
fac39fa36d | ||
|
|
d4f7e8cedc | ||
|
|
1395b874f4 | ||
|
|
a1fdfa700b | ||
|
|
8effbd1cb0 | ||
|
|
d74c61c133 | ||
|
|
0a36d417e8 | ||
|
|
6700198d64 | ||
|
|
a04fac84e7 | ||
|
|
4e98e65d53 | ||
|
|
9c6b926dae | ||
|
|
600402d986 | ||
|
|
4f236635e7 | ||
|
|
340a06778c | ||
|
|
7f4784c1c9 | ||
|
|
da3a807f22 | ||
|
|
26d417d758 | ||
|
|
454d297564 | ||
|
|
61e385a358 | ||
|
|
7a8ffcec7d | ||
|
|
332a367538 | ||
|
|
29fa4d203a | ||
|
|
59b2a899ca | ||
|
|
0826a54836 | ||
|
|
f421ebc056 | ||
|
|
25f5a1b2e1 | ||
|
|
032905b5a0 | ||
|
|
eebcfeb68e | ||
|
|
ba6714a200 | ||
|
|
0a181ca27a | ||
|
|
de9734a5bb | ||
|
|
9688071679 | ||
|
|
304190c49d | ||
|
|
50f476591f | ||
|
|
e0996decc3 | ||
|
|
39d8fc1edc | ||
|
|
443478109b | ||
|
|
206fd35a98 | ||
|
|
b95b553489 | ||
|
|
dd227f61df | ||
|
|
75cb678206 | ||
|
|
d7ae64627f | ||
|
|
6800f0a3c2 | ||
|
|
5832be768c | ||
|
|
498eb8e052 | ||
|
|
733b514326 | ||
|
|
688e56d0ac | ||
|
|
90be86fc91 | ||
|
|
838951c2d6 | ||
|
|
4dca1140cf | ||
|
|
bc7ea73da5 | ||
|
|
713b82131b | ||
|
|
538f95b1b7 | ||
|
|
c483b59124 | ||
|
|
2a1ed81ffc | ||
|
|
06bfada99b | ||
|
|
97cfdcd73b | ||
|
|
bccca0b53a | ||
|
|
465cfc499b | ||
|
|
4dce2f83f5 | ||
|
|
4be867e910 | ||
|
|
7e494d9225 | ||
|
|
34e39ebaf5 | ||
|
|
d80118dc16 | ||
|
|
c17434429d | ||
|
|
faf1567212 | ||
|
|
fddd0ac552 | ||
|
|
a08847ab39 | ||
|
|
c7fadd2328 | ||
|
|
38ebb55c7c | ||
|
|
82622d7583 | ||
|
|
c2ff964de0 | ||
|
|
4adc08a403 | ||
|
|
7dbe27222c | ||
|
|
5e4ee3d0bd | ||
|
|
eb1d1fe373 | ||
|
|
465aa1d38f | ||
|
|
b03438ba3a | ||
|
|
5ecc078a17 | ||
|
|
eae69fcf71 | ||
|
|
f448b0e6dd | ||
|
|
50254de0a2 | ||
|
|
282355efd5 | ||
|
|
6493b516f9 | ||
|
|
c93b461ad7 | ||
|
|
3306baca50 | ||
|
|
fc4cd598a2 | ||
|
|
703bbf5210 | ||
|
|
eaf9421df6 | ||
|
|
3b377b51a2 | ||
|
|
7931956805 | ||
|
|
f901bec494 | ||
|
|
3880b8785b | ||
|
|
5787f91c55 | ||
|
|
0f8312342f | ||
|
|
8462a3de1a | ||
|
|
8fc0bdfb0a | ||
|
|
797edd6211 | ||
|
|
ae23852e41 | ||
|
|
1c16749eaa | ||
|
|
e0e167e581 | ||
|
|
187ba4353a | ||
|
|
4f478af16d | ||
|
|
303a4ae44a | ||
|
|
90b24401d6 | ||
|
|
51e2015af3 | ||
|
|
957cb13a49 | ||
|
|
37c9728615 | ||
|
|
71297a254b | ||
|
|
75a4f484f0 | ||
|
|
5875bf754e | ||
|
|
2c508c4d40 | ||
|
|
2c182a77f7 | ||
|
|
e857936518 | ||
|
|
1ee6aad248 | ||
|
|
8813f2e0c3 | ||
|
|
988c3f9659 | ||
|
|
18071aaa08 | ||
|
|
ae0585c98e | ||
|
|
fb683030bf | ||
|
|
a480bf8093 | ||
|
|
ddea5c0816 | ||
|
|
f06efce387 | ||
|
|
8309c04464 | ||
|
|
44ef32ff2c | ||
|
|
766f827e26 | ||
|
|
aaea81de7c | ||
|
|
3ec37a74a2 | ||
|
|
78b0a85de6 | ||
|
|
b7fa5268e4 | ||
|
|
8162c3d1fd | ||
|
|
67bb06cc9b | ||
|
|
729cd8bacd | ||
|
|
3f282e57ec | ||
|
|
81396ea890 | ||
|
|
79cf2c56d3 | ||
|
|
b418fe266d | ||
|
|
963e50c8c4 | ||
|
|
1d2bbce532 | ||
|
|
073b6ea818 | ||
|
|
6dcd640f35 | ||
|
|
d7c98ca1ac | ||
|
|
ab98944195 | ||
|
|
ed4f90f0c7 | ||
|
|
6dd85f83f7 | ||
|
|
85ffe8dcdc | ||
|
|
553a0c52b1 | ||
|
|
84b6152842 | ||
|
|
cbdd21a22d | ||
|
|
8c6db654e7 | ||
|
|
7f68a7afe6 | ||
|
|
408272b8d9 | ||
|
|
fad87a24da | ||
|
|
edb9229b8b | ||
|
|
9552cf6b84 | ||
|
|
b63ea1047a | ||
|
|
cb9785add1 | ||
|
|
2dc75a9e93 | ||
|
|
2d858fbfb1 | ||
|
|
f73e419996 | ||
|
|
6d3d9104e6 | ||
|
|
2d7ada2c0b | ||
|
|
4fb8252186 | ||
|
|
7566742754 | ||
|
|
afe17cc1b6 | ||
|
|
f43097a2d7 | ||
|
|
64b1085464 | ||
|
|
882862563a | ||
|
|
7b7d99839c | ||
|
|
c70220205e | ||
|
|
8b9dd0a301 | ||
|
|
3646604203 | ||
|
|
8e9eeca0b3 | ||
|
|
44a80b64b9 | ||
|
|
6ec25f386f | ||
|
|
5199686873 | ||
|
|
226395a335 | ||
|
|
c34c523467 | ||
|
|
7215261349 | ||
|
|
cec5e30889 | ||
|
|
d80d918547 | ||
|
|
39c6aaa9cc | ||
|
|
fd5ff37db7 | ||
|
|
ce7935e82a | ||
|
|
40ba9f6a1a | ||
|
|
cff35ca0b2 | ||
|
|
788abb8cc8 | ||
|
|
32d128d219 | ||
|
|
45fa7596dc | ||
|
|
57cb01a927 | ||
|
|
838ae016d7 | ||
|
|
d4aff25473 | ||
|
|
f5768eaa2e | ||
|
|
186f9bab45 | ||
|
|
44192ce80b | ||
|
|
3549f48edc | ||
|
|
ab92ffee22 | ||
|
|
ff8da0dcff | ||
|
|
4f508003a9 | ||
|
|
92f71d9d42 | ||
|
|
03713ace23 | ||
|
|
f731477cd7 | ||
|
|
ca7547c9e2 | ||
|
|
e2c30c6a2e | ||
|
|
5e06dad411 | ||
|
|
f23bfc4b43 | ||
|
|
95e405023e | ||
|
|
4ff2665509 | ||
|
|
4be5b4aa25 | ||
|
|
3f8d21b922 | ||
|
|
0c6ff5eafa | ||
|
|
8b7aaad7d6 | ||
|
|
5cb25a2d32 | ||
|
|
767ddb1cd5 | ||
|
|
958e3b93c3 | ||
|
|
06c9633b43 | ||
|
|
f4332a36b4 | ||
|
|
1bb2a4f91c | ||
|
|
665e1f324a | ||
|
|
37ab72768f | ||
|
|
3d09626f0d | ||
|
|
039ca4e219 | ||
|
|
f1cf553437 | ||
|
|
8c04944b66 | ||
|
|
b20362c24b | ||
|
|
0ec7bfaa43 | ||
|
|
54fa0a69f8 | ||
|
|
f1a988af4b | ||
|
|
51d76c346e | ||
|
|
efe69168b4 | ||
|
|
675a9b2831 | ||
|
|
57257a4335 | ||
|
|
766d5846b1 | ||
|
|
7e9479083d | ||
|
|
cab1ea46e7 | ||
|
|
9efd7ddd0a | ||
|
|
217b9e7b41 | ||
|
|
c72957b409 | ||
|
|
ab8177de2c | ||
|
|
12d08db913 | ||
|
|
d94d0dda29 | ||
|
|
86de4d7af6 | ||
|
|
3c939e3f69 |
No files matched your search
@@ -11,9 +11,7 @@ end
|
||||
|
||||
define ____executor_globals
|
||||
if basic_functions_module.zts
|
||||
if !$tsrm_ls
|
||||
set $tsrm_ls = ts_resource_ex(0, 0)
|
||||
end
|
||||
set $tsrm_ls = _tsrm_ls_cache
|
||||
set $eg = ((zend_executor_globals*) (*((void ***) $tsrm_ls))[executor_globals_id-1])
|
||||
set $cg = ((zend_compiler_globals*) (*((void ***) $tsrm_ls))[compiler_globals_id-1])
|
||||
set $eg_ptr = $eg
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.01
|
||||
Copyright (c) 1999 - 2019 The PHP Group. All rights reserved.
|
||||
Copyright (c) 1999 - 2021 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,21 +1,158 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2021, PHP 8.0.3
|
||||
06 May 2021, PHP 8.0.6
|
||||
|
||||
- PDO_pgsql:
|
||||
. Revert "Fixed bug #80892 (PDO::PARAM_INT is treated the same as PDO::PARAM_STR)"
|
||||
from PHP 8.0.5.
|
||||
|
||||
29 Apr 2021, PHP 8.0.5
|
||||
|
||||
- Core:
|
||||
. Fixed bug #75776 (Flushing streams with compression filter is broken). (cmb)
|
||||
. Fixed bug #80811 (Function exec without $output but with $restult_code
|
||||
parameter crashes). (Nikita)
|
||||
. Fixed bug #80814 (threaded mod_php won't load on FreeBSD: No space
|
||||
available for static Thread Local Storage). (Dmitry)
|
||||
. Changed PowerPC CPU registers used by Zend VM to work around GCC bug.
|
||||
Old registers (r28/r29) might be clobbered by _restgpr routine used for
|
||||
return from C function compiled with -Os. (Dmitry)
|
||||
|
||||
- Dba:
|
||||
. Fixed bug #80817 (dba_popen() may cause segfault during RSHUTDOWN). (cmb)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug #66783 (UAF when appending DOMDocument to element). (cmb)
|
||||
|
||||
- FFI:
|
||||
. Fixed bug #80847 (CData structs with fields of type struct can't be passed
|
||||
as C function argument). (Nickolas Daniel da Silva, Dmitry)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #80024 (Duplication of info about inherited socket after pool
|
||||
removing). (Jakub Zelenka)
|
||||
|
||||
- FTP:
|
||||
. Fixed bug #80880 (SSL_read on shutdown, ftp/proc_open). (cmb, Jakub
|
||||
Zelenka)
|
||||
|
||||
- IMAP:
|
||||
. Fixed bug #80800 (imap_open() fails when the flags parameter includes
|
||||
CL_EXPUNGE). (girgias)
|
||||
. Fixed bug #80710 (imap_mail_compose() header injection). (cmb, Stas)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #80763 (msgfmt_format() does not accept DateTime references).
|
||||
(cmb)
|
||||
|
||||
- LibXML:
|
||||
. Fixed bug #73533 (Invalid memory access in php_libxml_xmlCheckUTF8). (cmb)
|
||||
. Fixed bug #51903 (simplexml_load_file() doesn't use HTTP headers). (cmb)
|
||||
|
||||
- MySQLnd:
|
||||
. Fixed bug #80837 (Calling stmt_store_result after fetch doesn't throw an
|
||||
error). (Kamil Tekiela)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #80839 (PHP problem with JIT). (Dmitry)
|
||||
. Fixed bug #80861 (erronous array key overflow in 2D array with JIT).
|
||||
(Dmitry)
|
||||
. Fixed bug #80786 (PHP crash using JIT). (Nikita)
|
||||
. Fixed bug #80782 (DASM_S_RANGE_VREG on PHP_INT_MIN-1). (Dmitry)
|
||||
|
||||
- Pcntl:
|
||||
. Fixed bug #79812 (Potential integer overflow in pcntl_exec()). (cmb)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #80866 (preg_split ignores limit flag when pattern with \K has
|
||||
0-width fullstring match). (Kamil Tekiela)
|
||||
|
||||
- PDO_ODBC:
|
||||
. Fixed bug #80783 (PDO ODBC truncates BLOB records at every 256th byte).
|
||||
(cmb)
|
||||
|
||||
- PDO_pgsql:
|
||||
. Fixed bug #80892 (PDO::PARAM_INT is treated the same as PDO::PARAM_STR).
|
||||
(Matteo)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #80889 (Cannot set save handler when save_handler is invalid).
|
||||
(cmb)
|
||||
. Fixed bug #80774 (session_name() problem with backslash). (cmb)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #69668 (SOAP special XML characters in namespace URIs not
|
||||
encoded). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #80915 (Taking a reference to $_SERVER hides its values from
|
||||
phpinfo()). (Rowan Tommins)
|
||||
. Fixed bug #80914 ('getdir' accidentally defined as an alias of 'dir').
|
||||
(Rowan Tommins)
|
||||
. Fixed bug #80771 (phpinfo(INFO_CREDITS) displays nothing in CLI). (cmb)
|
||||
. Fixed bug #78719 (http wrapper silently ignores long Location headers).
|
||||
(cmb)
|
||||
. Fixed bug #80838 (HTTP wrapper waits for HTTP 1 response after HTTP 101).
|
||||
(manuelm)
|
||||
|
||||
- Zip:
|
||||
. Fixed bug #80825 (ZipArchive::isCompressionMethodSupported does not exist).
|
||||
(cmb)
|
||||
|
||||
18 Feb 2021, PHP 8.0.3
|
||||
|
||||
- Core:
|
||||
. Fixed #80706 (mail(): Headers after Bcc headers may be ignored). (cmb)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug #80600 (DOMChildNode::remove() doesn't work on CharacterData
|
||||
nodes). (beberlei)
|
||||
|
||||
- Gettext:
|
||||
. Fixed bug #53251 (bindtextdomain with null dir doesn't return old value).
|
||||
(cmb)
|
||||
|
||||
- MySQLnd:
|
||||
. Fixed bug #78680 (mysqlnd's mysql_clear_password does not transmit
|
||||
null-terminated password). (Daniel Black)
|
||||
. Fixed bug #80713 (SegFault when disabling ATTR_EMULATE_PREPARES and
|
||||
MySQL 8.0). (Nikita)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #74779 (x() and y() truncating floats to integers). (cmb)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #80634 (write_property handler of internal classes is skipped on
|
||||
preloaded JITted code). (Dmitry)
|
||||
. Fixed bug #80682 (opcache doesn't honour pcre.jit option). (Remi)
|
||||
. Fixed bug #80742 (Opcache JIT makes some boolean logic unexpectedly be
|
||||
true). (Dmitry)
|
||||
. Fixed bug #80745 (JIT produces Assert failure and UNKNOWN:0 var_dumps in
|
||||
code involving bitshifts). (Dmitry)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #80747 (Providing RSA key size < 512 generates key that crash
|
||||
PHP). (Nikita)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #75850 (Unclear error message wrt. __halt_compiler() w/o
|
||||
semicolon) (cmb)
|
||||
. Fixed bug #70091 (Phar does not mark UTF-8 filenames in ZIP archives). (cmb)
|
||||
. Fixed bug #53467 (Phar cannot compress large archives). (cmb, lserni)
|
||||
|
||||
- Socket:
|
||||
. Fixed bug #80723 (Different sockets compare as equal (regression in 8.0)).
|
||||
(Nikita)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug#80719 (Iterating after failed ArrayObject::setIteratorClass()
|
||||
causes Segmentation fault). (Nikita)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #80654 (file_get_contents() maxlen fails above (2**31)-1 bytes).
|
||||
(cmb)
|
||||
. Fixed bug #80718 (ext/standard/dl.c fallback code path with syntax error).
|
||||
(Nikita)
|
||||
|
||||
21 Jan 2021, PHP 8.0.2
|
||||
|
||||
@@ -170,7 +307,7 @@ PHP NEWS
|
||||
. Fixed #62004 (SplFileObject: fgets after seek returns wrong line). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #77423 (FILTER_VALIDATE_URL accepts URLs with invalid userinfo).
|
||||
. Fixed bug #77423 (FILTER_VALIDATE_URL accepts URLs with invalid userinfo).
|
||||
(CVE-2020-7071) (cmb)
|
||||
. Fixed bug #80366 (Return Value of zend_fstat() not Checked). (sagpant, cmb)
|
||||
|
||||
@@ -560,4 +697,3 @@ PHP NEWS
|
||||
. Fixed bug #71417 (fread() does not report zlib.inflate errors). (cmb)
|
||||
. Fixed bug #78792 (zlib.output_compression disabled by Content-Type: image/).
|
||||
(cmb)
|
||||
|
||||
+2
-2
@@ -729,13 +729,13 @@ TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
|
||||
#if defined(__APPLE__) && defined(__x86_64__)
|
||||
// TODO: Implement support for fast JIT ZTS code ???
|
||||
return 0;
|
||||
#elif defined(__x86_64__) && defined(__GNUC__)
|
||||
#elif defined(__x86_64__) && defined(__GNUC__) && !defined(__FreeBSD__)
|
||||
size_t ret;
|
||||
|
||||
asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0"
|
||||
: "=r" (ret));
|
||||
return ret;
|
||||
#elif defined(__i386__) && defined(__GNUC__)
|
||||
#elif defined(__i386__) && defined(__GNUC__) && !defined(__FreeBSD__)
|
||||
size_t ret;
|
||||
|
||||
asm ("leal _tsrm_ls_cache@ntpoff,%0"
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ TSRM_API const char *tsrm_api_name(void);
|
||||
# define __has_attribute(x) 0
|
||||
#endif
|
||||
|
||||
#if !__has_attribute(tls_model)
|
||||
#if !__has_attribute(tls_model) || defined(__FreeBSD__)
|
||||
# define TSRM_TLS_MODEL_ATTR
|
||||
#elif __PIC__
|
||||
# define TSRM_TLS_MODEL_ATTR __attribute__((tls_model("initial-exec")))
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
HT iterator should be destroyed if array becomes empty during array_splice
|
||||
--FILE--
|
||||
<?php
|
||||
$a=[4];
|
||||
$i = 0;
|
||||
foreach ($a as &$r) {
|
||||
var_dump($r);
|
||||
$a = array_splice($a, 0);
|
||||
if (++$i == 2) break;
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
int(4)
|
||||
int(4)
|
||||
@@ -8,4 +8,4 @@ class A1 { }
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Attribute::__construct(): Argument #1 ($flags) must must be of type int, string given in %s
|
||||
Fatal error: Attribute::__construct(): Argument #1 ($flags) must be of type int, string given in %s
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Bug #80781: Error handler that throws ErrorException infinite loop
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function handle(int $severity, string $message, string $file, int $line): bool {
|
||||
if((error_reporting() & $severity) !== 0) {
|
||||
throw new \ErrorException($message, 0, $severity, $file, $line);
|
||||
}
|
||||
|
||||
return true; // stfu operator
|
||||
}
|
||||
|
||||
set_error_handler('handle');
|
||||
|
||||
function getPlugin(string $plugin) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$array = [];
|
||||
if (isset($array[$data]) or getPlugin($data)) {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #80811: Function exec without $output but with $restult_code parameter crashes
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
echo 'Executing with all params:' . PHP_EOL;
|
||||
exec('echo Something', output: $output, result_code: $resultCode);
|
||||
var_dump($resultCode);
|
||||
|
||||
echo 'Executing without output param:' . PHP_EOL;
|
||||
exec('echo Something', result_code: $resultCode);
|
||||
var_dump($resultCode);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Executing with all params:
|
||||
int(0)
|
||||
Executing without output param:
|
||||
int(0)
|
||||
@@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
call_user_func_array() + array_slice() + named arguments
|
||||
--FILE--
|
||||
<?php
|
||||
call_user_func_array('func', array_slice(array: $a, 1, 2));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot use positional argument after named argument in %s on line %d
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Dynamic static call of non-static method
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
function test1() {
|
||||
$method = ['Foo', 'bar'];
|
||||
$method();
|
||||
}
|
||||
function test2() {
|
||||
$method = 'Foo::bar';
|
||||
$method();
|
||||
}
|
||||
function __call($name, $args) {}
|
||||
}
|
||||
$x = new Foo;
|
||||
try {
|
||||
$x->test1();
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
try {
|
||||
$x->test2();
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
Non-static method Foo::bar() cannot be called statically
|
||||
Non-static method Foo::bar() cannot be called statically
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Promoting require_once warning to exception
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
|
||||
throw new Exception($errstr);
|
||||
}
|
||||
set_error_handler("exception_error_handler");
|
||||
|
||||
try {
|
||||
$results = require_once 'does-not-exist.php';
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
};
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
require_once(does-not-exist.php): Failed to open stream: No such file or directory
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Symtable cache slots may be acquired while cleaning symtable
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
// Must be larger than the symtable cache.
|
||||
static $max = 40;
|
||||
function __destruct() {
|
||||
if (self::$max-- < 0) return;
|
||||
$x = 'y';
|
||||
$$x = new a;
|
||||
}
|
||||
}
|
||||
new A;
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "4.0.3-dev"
|
||||
#define ZEND_VERSION "4.0.6"
|
||||
|
||||
#define ZEND_ENGINE_3
|
||||
|
||||
|
||||
+1
-1
@@ -1099,7 +1099,7 @@ static zend_always_inline void zend_mm_free_pages_ex(zend_mm_heap *heap, zend_mm
|
||||
/* this setting may be not accurate */
|
||||
chunk->free_tail = page_num;
|
||||
}
|
||||
if (free_chunk && chunk->free_pages == ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE) {
|
||||
if (free_chunk && chunk != heap->main_chunk && chunk->free_pages == ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE) {
|
||||
zend_mm_delete_chunk(heap, chunk);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void validate_attribute(zend_attribute *attr, uint32_t target, zend_class_entry
|
||||
|
||||
if (Z_TYPE(flags) != IS_LONG) {
|
||||
zend_error_noreturn(E_ERROR,
|
||||
"Attribute::__construct(): Argument #1 ($flags) must must be of type int, %s given",
|
||||
"Attribute::__construct(): Argument #1 ($flags) must be of type int, %s given",
|
||||
zend_zval_type_name(&flags)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3878,6 +3878,7 @@ zend_result zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_stri
|
||||
zend_string *name = zend_resolve_function_name(orig_name, args->child[1]->child[0]->attr, &is_fully_qualified);
|
||||
|
||||
if (zend_string_equals_literal_ci(name, "array_slice")
|
||||
&& !zend_args_contain_unpack_or_named(list)
|
||||
&& list->children == 3
|
||||
&& list->child[1]->kind == ZEND_AST_ZVAL) {
|
||||
zval *zv = zend_ast_get_zval(list->child[1]);
|
||||
|
||||
@@ -123,3 +123,7 @@ class ArithmeticError extends Error
|
||||
class DivisionByZeroError extends ArithmeticError
|
||||
{
|
||||
}
|
||||
|
||||
class UnhandledMatchError extends Error
|
||||
{
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 3699b51b31e509c11435845c7e0d35a2608dd268 */
|
||||
* Stub hash: 2fa61163fb7db8d87b14f9cf9a42c3cd8093f2a6 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Throwable_getMessage, 0, 0, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -180,3 +180,8 @@ static const zend_function_entry class_ArithmeticError_methods[] = {
|
||||
static const zend_function_entry class_DivisionByZeroError_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_UnhandledMatchError_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
+21
-9
@@ -54,11 +54,11 @@
|
||||
# define ZEND_VM_FP_GLOBAL_REG "%r14"
|
||||
# define ZEND_VM_IP_GLOBAL_REG "%r15"
|
||||
# elif defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(__powerpc64__)
|
||||
# define ZEND_VM_FP_GLOBAL_REG "r28"
|
||||
# define ZEND_VM_IP_GLOBAL_REG "r29"
|
||||
# define ZEND_VM_FP_GLOBAL_REG "r14"
|
||||
# define ZEND_VM_IP_GLOBAL_REG "r15"
|
||||
# elif defined(__IBMC__) && ZEND_GCC_VERSION >= 4002 && defined(__powerpc64__)
|
||||
# define ZEND_VM_FP_GLOBAL_REG "r28"
|
||||
# define ZEND_VM_IP_GLOBAL_REG "r29"
|
||||
# define ZEND_VM_FP_GLOBAL_REG "r14"
|
||||
# define ZEND_VM_IP_GLOBAL_REG "r15"
|
||||
# elif defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(__aarch64__)
|
||||
# define ZEND_VM_FP_GLOBAL_REG "x27"
|
||||
# define ZEND_VM_IP_GLOBAL_REG "x28"
|
||||
@@ -1144,7 +1144,7 @@ static zend_always_inline zend_bool zend_internal_call_should_throw(zend_functio
|
||||
|
||||
static ZEND_COLD void zend_internal_call_arginfo_violation(zend_function *fbc)
|
||||
{
|
||||
zend_error(E_CORE_ERROR, "Arginfo / zpp mismatch during call of %s%s%s()",
|
||||
zend_error(E_ERROR, "Arginfo / zpp mismatch during call of %s%s%s()",
|
||||
fbc->common.scope ? ZSTR_VAL(fbc->common.scope->name) : "",
|
||||
fbc->common.scope ? "::" : "",
|
||||
ZSTR_VAL(fbc->common.function_name));
|
||||
@@ -3396,12 +3396,13 @@ ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_val
|
||||
|
||||
ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table) /* {{{ */
|
||||
{
|
||||
/* Clean before putting into the cache, since clean could call dtors,
|
||||
* which could use the cached hash. Also do this before the check for
|
||||
* available cache slots, as those may be used by a dtor as well. */
|
||||
zend_symtable_clean(symbol_table);
|
||||
if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) {
|
||||
zend_array_destroy(symbol_table);
|
||||
} else {
|
||||
/* clean before putting into the cache, since clean
|
||||
could call dtors, which could use cached hash */
|
||||
zend_symtable_clean(symbol_table);
|
||||
*(EG(symtable_cache_ptr)++) = symbol_table;
|
||||
}
|
||||
}
|
||||
@@ -4004,6 +4005,10 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_s
|
||||
|
||||
if (UNEXPECTED(!(fbc->common.fn_flags & ZEND_ACC_STATIC))) {
|
||||
zend_non_static_method_call(fbc);
|
||||
if (fbc->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
|
||||
zend_string_release_ex(fbc->common.function_name, 0);
|
||||
zend_free_trampoline(fbc);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!RUN_TIME_CACHE(&fbc->op_array))) {
|
||||
@@ -4128,6 +4133,10 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_array(zend_ar
|
||||
}
|
||||
if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
|
||||
zend_non_static_method_call(fbc);
|
||||
if (fbc->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
|
||||
zend_string_release_ex(fbc->common.function_name, 0);
|
||||
zend_free_trampoline(fbc);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
object_or_called_scope = called_scope;
|
||||
@@ -4224,7 +4233,7 @@ static zend_never_inline zend_op_array* ZEND_FASTCALL zend_include_or_eval(zval
|
||||
already_compiled:
|
||||
new_op_array = ZEND_FAKE_OP_ARRAY;
|
||||
}
|
||||
} else {
|
||||
} else if (!EG(exception)) {
|
||||
zend_message_dispatcher(
|
||||
(type == ZEND_INCLUDE_ONCE) ?
|
||||
ZMSG_FAILED_INCLUDE_FOPEN : ZMSG_FAILED_REQUIRE_FOPEN,
|
||||
@@ -4570,6 +4579,9 @@ ZEND_API zend_result ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *cal
|
||||
}
|
||||
|
||||
ZVAL_COPY_VALUE(arg, &default_value);
|
||||
if (ZEND_ARG_SEND_MODE(arg_info) & ZEND_SEND_BY_REF) {
|
||||
ZVAL_NEW_REF(arg, arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,3 +20,7 @@ final class Generator implements Iterator
|
||||
|
||||
public function getReturn(): mixed {}
|
||||
}
|
||||
|
||||
class ClosedGeneratorException extends Exception
|
||||
{
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 18d2bb68729ff622a5c0c124a8822f7ee882c2ec */
|
||||
* Stub hash: 50044c6c8d2a162a988906c0b752a5fe28adb933 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Generator_rewind, 0, 0, IS_VOID, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -46,3 +46,8 @@ static const zend_function_entry class_Generator_methods[] = {
|
||||
ZEND_ME(Generator, getReturn, arginfo_class_Generator_getReturn, ZEND_ACC_PUBLIC)
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_ClosedGeneratorException_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
+1
-1
@@ -1655,10 +1655,10 @@ ZEND_API void ZEND_FASTCALL zend_array_destroy(HashTable *ht)
|
||||
} else if (EXPECTED(HT_FLAGS(ht) & HASH_FLAG_UNINITIALIZED)) {
|
||||
goto free_ht;
|
||||
}
|
||||
zend_hash_iterators_remove(ht);
|
||||
SET_INCONSISTENT(HT_DESTROYED);
|
||||
efree(HT_GET_DATA_ADDR(ht));
|
||||
free_ht:
|
||||
zend_hash_iterators_remove(ht);
|
||||
FREE_HASHTABLE(ht);
|
||||
}
|
||||
|
||||
|
||||
@@ -1608,6 +1608,11 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_objects_not_comparable(zval *o1, zval *o2)
|
||||
{
|
||||
return ZEND_UNCOMPARABLE;
|
||||
}
|
||||
|
||||
ZEND_API int zend_std_has_property(zend_object *zobj, zend_string *name, int has_set_exists, void **cache_slot) /* {{{ */
|
||||
{
|
||||
int result;
|
||||
|
||||
@@ -213,6 +213,10 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2);
|
||||
ZEND_API int zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only);
|
||||
ZEND_API void rebuild_object_properties(zend_object *zobj);
|
||||
|
||||
/* Handler for objects that cannot be meaningfully compared.
|
||||
* Only objects with the same identity will be considered equal. */
|
||||
ZEND_API int zend_objects_not_comparable(zval *o1, zval *o2);
|
||||
|
||||
ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope);
|
||||
|
||||
ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name, zend_bool is_dynamic);
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ jobs:
|
||||
CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC'
|
||||
LDFLAGS='-fsanitize=undefined,address'
|
||||
runTestsParameters: --asan
|
||||
timeoutInMinutes: 310
|
||||
timeoutInMinutes: 360
|
||||
- template: azure/msan_job.yml
|
||||
parameters:
|
||||
configurationName: DEBUG_ZTS_MSAN
|
||||
|
||||
@@ -51,8 +51,7 @@ jobs:
|
||||
- script: |
|
||||
git clone https://github.com/laravel/framework.git --branch=master --depth=1
|
||||
cd framework
|
||||
#php7.3 /usr/bin/composer require "doctrine/dbal:^3.0" --no-interaction
|
||||
php7.3 /usr/bin/composer install --no-progress
|
||||
php7.4 /usr/bin/composer install --no-progress
|
||||
# Hack to disable a test that hangs on azure
|
||||
sed -i 's/PHP_OS/"Darwin"/' tests/Filesystem/FilesystemTest.php
|
||||
export USE_ZEND_ALLOC=0
|
||||
@@ -65,8 +64,8 @@ jobs:
|
||||
- script: |
|
||||
git clone https://github.com/symfony/symfony.git --depth=1
|
||||
cd symfony
|
||||
php7.3 /usr/bin/composer install --no-progress
|
||||
php7.3 ./phpunit install
|
||||
php7.4 /usr/bin/composer install --no-progress
|
||||
php7.4 ./phpunit install
|
||||
export USE_ZEND_ALLOC=0
|
||||
export USE_TRACKED_ALLOC=1
|
||||
export ASAN_OPTIONS=exitcode=139
|
||||
@@ -96,14 +95,14 @@ jobs:
|
||||
export USE_ZEND_ALLOC=0
|
||||
export USE_TRACKED_ALLOC=1
|
||||
export ASAN_OPTIONS=exitcode=139
|
||||
php7.3 /usr/bin/composer install --no-progress
|
||||
php7.4 /usr/bin/composer install --no-progress
|
||||
php ./phpunit
|
||||
if [ $? -gt 128 ]; then
|
||||
exit 1
|
||||
fi
|
||||
displayName: 'Test PHPUnit'
|
||||
- script: |
|
||||
php7.3 /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress
|
||||
php7.4 /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress
|
||||
cd symfony_demo
|
||||
export USE_ZEND_ALLOC=0
|
||||
export USE_TRACKED_ALLOC=1
|
||||
|
||||
@@ -116,6 +116,7 @@ clean:
|
||||
find . -name \*.so | xargs rm -f
|
||||
find . -name .libs -a -type d|xargs rm -rf
|
||||
rm -f libphp.la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/*
|
||||
rm -f ext/opcache/jit/zend_jit_x86.c
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h
|
||||
@@ -124,7 +125,6 @@ distclean: clean
|
||||
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 sapi/phpdbg/phpdbg.1 ext/phar/phar.1 ext/phar/phar.phar.1
|
||||
rm -f sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html
|
||||
rm -f ext/phar/phar.phar ext/phar/phar.php
|
||||
rm -f ext/opcache/jit/zend_jit_x86.c
|
||||
if test "$(srcdir)" != "$(builddir)"; then \
|
||||
rm -f ext/phar/phar/phar.inc; \
|
||||
fi
|
||||
|
||||
+2
-1
@@ -793,9 +793,10 @@ class FuncInfo {
|
||||
}
|
||||
|
||||
if ($namespace) {
|
||||
// Render A\B as "A\\B" in C strings for namespaces
|
||||
return sprintf(
|
||||
"\tZEND_NS_FE(\"%s\", %s, %s)\n",
|
||||
$namespace, $declarationName, $this->getArgInfoName());
|
||||
addslashes($namespace), $declarationName, $this->getArgInfoName());
|
||||
} else {
|
||||
return sprintf("\tZEND_FE(%s, %s)\n", $declarationName, $this->getArgInfoName());
|
||||
}
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice.
|
||||
dnl ----------------------------------------------------------------------------
|
||||
|
||||
AC_PREREQ([2.68])
|
||||
AC_INIT([PHP],[8.0.3-dev],[https://bugs.php.net],[php],[https://www.php.net])
|
||||
AC_INIT([PHP],[8.0.6],[https://bugs.php.net],[php],[https://www.php.net])
|
||||
AC_CONFIG_SRCDIR([main/php_version.h])
|
||||
AC_CONFIG_AUX_DIR([build])
|
||||
AC_PRESERVE_HELP_ORDER
|
||||
@@ -524,7 +524,7 @@ dnl Fix for these systems is already included in GCC 7, but not on GCC 6.
|
||||
dnl
|
||||
dnl At least some versions of FreeBSD seem to have buggy ifunc support, see
|
||||
dnl bug #77284. Conservatively don't use ifuncs on FreeBSD.
|
||||
AS_CASE([$host_alias], [*-*-*android*|*-*-*uclibc*|*-*-*musl*|*freebsd*], [true], [
|
||||
AS_CASE([$host_alias], [*-*-*android*|*-*-*uclibc*|*-*-*musl*|*freebsd*|*openbsd*], [true], [
|
||||
AX_GCC_FUNC_ATTRIBUTE([ifunc])
|
||||
AX_GCC_FUNC_ATTRIBUTE([target])
|
||||
])
|
||||
|
||||
+10
-3
@@ -39,6 +39,7 @@ typedef struct _php_bz2_filter_data {
|
||||
enum strm_status status; /* Decompress option */
|
||||
unsigned int small_footprint : 1; /* Decompress option */
|
||||
unsigned int expect_concatenated : 1; /* Decompress option */
|
||||
unsigned int is_flushed : 1; /* only for compression */
|
||||
|
||||
int persistent;
|
||||
} php_bz2_filter_data;
|
||||
@@ -227,6 +228,8 @@ static php_stream_filter_status_t php_bz2_compress_filter(
|
||||
bucket = php_stream_bucket_make_writeable(buckets_in->head);
|
||||
|
||||
while (bin < bucket->buflen) {
|
||||
int flush_mode;
|
||||
|
||||
desired = bucket->buflen - bin;
|
||||
if (desired > data->inbuf_len) {
|
||||
desired = data->inbuf_len;
|
||||
@@ -234,7 +237,9 @@ static php_stream_filter_status_t php_bz2_compress_filter(
|
||||
memcpy(data->strm.next_in, bucket->buf + bin, desired);
|
||||
data->strm.avail_in = desired;
|
||||
|
||||
status = BZ2_bzCompress(&(data->strm), flags & PSFS_FLAG_FLUSH_CLOSE ? BZ_FINISH : (flags & PSFS_FLAG_FLUSH_INC ? BZ_FLUSH : BZ_RUN));
|
||||
flush_mode = flags & PSFS_FLAG_FLUSH_CLOSE ? BZ_FINISH : (flags & PSFS_FLAG_FLUSH_INC ? BZ_FLUSH : BZ_RUN);
|
||||
data->is_flushed = flush_mode != BZ_RUN;
|
||||
status = BZ2_bzCompress(&(data->strm), flush_mode);
|
||||
if (status != BZ_RUN_OK && status != BZ_FLUSH_OK && status != BZ_FINISH_OK) {
|
||||
/* Something bad happened */
|
||||
php_stream_bucket_delref(bucket);
|
||||
@@ -260,11 +265,12 @@ static php_stream_filter_status_t php_bz2_compress_filter(
|
||||
php_stream_bucket_delref(bucket);
|
||||
}
|
||||
|
||||
if (flags & PSFS_FLAG_FLUSH_CLOSE) {
|
||||
if (flags & PSFS_FLAG_FLUSH_CLOSE || ((flags & PSFS_FLAG_FLUSH_INC) && !data->is_flushed)) {
|
||||
/* Spit it out! */
|
||||
status = BZ_FINISH_OK;
|
||||
while (status == BZ_FINISH_OK) {
|
||||
status = BZ2_bzCompress(&(data->strm), BZ_FINISH);
|
||||
status = BZ2_bzCompress(&(data->strm), (flags & PSFS_FLAG_FLUSH_CLOSE ? BZ_FINISH : BZ_FLUSH));
|
||||
data->is_flushed = 1;
|
||||
if (data->strm.avail_out < data->outbuf_len) {
|
||||
size_t bucketlen = data->outbuf_len - data->strm.avail_out;
|
||||
|
||||
@@ -380,6 +386,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
|
||||
}
|
||||
|
||||
status = BZ2_bzCompressInit(&(data->strm), blockSize100k, 0, workFactor);
|
||||
data->is_flushed = 1;
|
||||
fops = &php_bz2_compress_ops;
|
||||
} else {
|
||||
status = BZ_DATA_ERROR;
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #75776 (Flushing streams with compression filter is broken)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('bz2')) die('skip bz2 extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$text = str_repeat('0123456789abcdef', 1000);
|
||||
|
||||
$temp = fopen('php://temp', 'r+');
|
||||
stream_filter_append($temp, 'bzip2.compress', STREAM_FILTER_WRITE);
|
||||
fwrite($temp, $text);
|
||||
|
||||
rewind($temp);
|
||||
|
||||
var_dump(bin2hex(stream_get_contents($temp)));
|
||||
var_dump(ftell($temp));
|
||||
|
||||
fclose($temp);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(144) "425a68343141592653599fe7bbbf0001f389007fe03f002000902980026826aa80003ea9061520c6a41954833a9069520d6a41b54837a9071520e6a41d5483ba9079520f6a41f548"
|
||||
int(72)
|
||||
@@ -1200,6 +1200,7 @@ PHP_MINIT_FUNCTION(curl)
|
||||
curl_object_handlers.get_constructor = curl_get_constructor;
|
||||
curl_object_handlers.clone_obj = curl_clone_obj;
|
||||
curl_object_handlers.cast_object = curl_cast_object;
|
||||
curl_object_handlers.compare = zend_objects_not_comparable;
|
||||
|
||||
curl_multi_register_class(class_CurlMultiHandle_methods);
|
||||
curl_share_register_class(class_CurlShareHandle_methods);
|
||||
@@ -2046,6 +2047,7 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields
|
||||
#endif
|
||||
|
||||
prop = zend_read_property(curl_CURLFile_class, Z_OBJ_P(current), "name", sizeof("name")-1, 0, &rv);
|
||||
ZVAL_DEREF(prop);
|
||||
if (Z_TYPE_P(prop) != IS_STRING) {
|
||||
php_error_docref(NULL, E_WARNING, "Invalid filename for key %s", ZSTR_VAL(string_key));
|
||||
} else {
|
||||
@@ -2056,10 +2058,12 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields
|
||||
}
|
||||
|
||||
prop = zend_read_property(curl_CURLFile_class, Z_OBJ_P(current), "mime", sizeof("mime")-1, 0, &rv);
|
||||
ZVAL_DEREF(prop);
|
||||
if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) {
|
||||
type = Z_STRVAL_P(prop);
|
||||
}
|
||||
prop = zend_read_property(curl_CURLFile_class, Z_OBJ_P(current), "postname", sizeof("postname")-1, 0, &rv);
|
||||
ZVAL_DEREF(prop);
|
||||
if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) {
|
||||
filename = Z_STRVAL_P(prop);
|
||||
}
|
||||
|
||||
@@ -603,4 +603,5 @@ void curl_multi_register_class(const zend_function_entry *method_entries) {
|
||||
curl_multi_handlers.get_constructor = curl_multi_get_constructor;
|
||||
curl_multi_handlers.clone_obj = NULL;
|
||||
curl_multi_handlers.cast_object = curl_cast_object;
|
||||
curl_multi_handlers.compare = zend_objects_not_comparable;
|
||||
}
|
||||
@@ -176,4 +176,5 @@ void curl_share_register_class(const zend_function_entry *method_entries) {
|
||||
curl_share_handlers.free_obj = curl_share_free_obj;
|
||||
curl_share_handlers.get_constructor = curl_share_get_constructor;
|
||||
curl_share_handlers.clone_obj = NULL;
|
||||
curl_share_handlers.compare = zend_objects_not_comparable;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ PSL => No
|
||||
HTTPS_PROXY => Yes
|
||||
MULTI_SSL => %s
|
||||
BROTLI => %s
|
||||
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, %r(mqtt, )?%rpop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
|
||||
Protocols => dict, file, ftp, ftps, gopher, %r(gophers, )?%rhttp, https, imap, imaps, ldap, ldaps, %r(mqtt, )?%rpop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
|
||||
Host => %s-pc-win32
|
||||
SSL Version => OpenSSL/%s
|
||||
ZLib Version => %s
|
||||
|
||||
+2
-2
@@ -863,9 +863,9 @@ restart:
|
||||
zend_bool close_both;
|
||||
|
||||
close_both = (info->fp != info->lock.fp);
|
||||
php_stream_close(info->lock.fp);
|
||||
php_stream_free(info->lock.fp, persistent ? PHP_STREAM_FREE_CLOSE_PERSISTENT : PHP_STREAM_FREE_CLOSE);
|
||||
if (close_both) {
|
||||
php_stream_close(info->fp);
|
||||
php_stream_free(info->fp, persistent ? PHP_STREAM_FREE_CLOSE_PERSISTENT : PHP_STREAM_FREE_CLOSE);
|
||||
}
|
||||
info->fp = NULL;
|
||||
info->lock.fp = NULL;
|
||||
|
||||
+2
-34
@@ -349,9 +349,8 @@ PHP_METHOD(DOMCharacterData, replaceData)
|
||||
PHP_METHOD(DOMCharacterData, remove)
|
||||
{
|
||||
zval *id = ZEND_THIS;
|
||||
xmlNodePtr children, child;
|
||||
xmlNodePtr child;
|
||||
dom_object *intern;
|
||||
int stricterror;
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
@@ -359,38 +358,7 @@ PHP_METHOD(DOMCharacterData, remove)
|
||||
|
||||
DOM_GET_OBJ(child, id, xmlNodePtr, intern);
|
||||
|
||||
if (dom_node_children_valid(child) == FAILURE) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
stricterror = dom_get_strict_error(intern->document);
|
||||
|
||||
if (dom_node_is_read_only(child) == SUCCESS ||
|
||||
(child->parent != NULL && dom_node_is_read_only(child->parent) == SUCCESS)) {
|
||||
php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, stricterror);
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
if (!child->parent) {
|
||||
php_dom_throw_error(NOT_FOUND_ERR, stricterror);
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
children = child->parent->children;
|
||||
if (!children) {
|
||||
php_dom_throw_error(NOT_FOUND_ERR, stricterror);
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
while (children) {
|
||||
if (children == child) {
|
||||
xmlUnlinkNode(child);
|
||||
RETURN_NULL();
|
||||
}
|
||||
children = children->next;
|
||||
}
|
||||
|
||||
php_dom_throw_error(NOT_FOUND_ERR, stricterror);
|
||||
dom_child_node_remove(intern);
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -986,7 +986,7 @@ PHP_METHOD(DOMDocument, getElementsByTagNameNS)
|
||||
xmlChar *local, *nsuri;
|
||||
|
||||
id = ZEND_THIS;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &uri, &uri_len, &name, &name_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
@@ -995,7 +995,7 @@ PHP_METHOD(DOMDocument, getElementsByTagNameNS)
|
||||
php_dom_create_iterator(return_value, DOM_NODELIST);
|
||||
namednode = Z_DOMOBJ_P(return_value);
|
||||
local = xmlCharStrndup(name, name_len);
|
||||
nsuri = xmlCharStrndup(uri, uri_len);
|
||||
nsuri = xmlCharStrndup(uri ? uri : "", uri_len);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri);
|
||||
}
|
||||
/* }}} end dom_document_get_elements_by_tag_name_ns */
|
||||
|
||||
@@ -127,7 +127,7 @@ PHP_METHOD(DOMImplementation, createDocument)
|
||||
char *prefix = NULL, *localname = NULL;
|
||||
dom_object *doctobj;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ssO!", &uri, &uri_len, &name, &name_len, &node, dom_documenttype_class_entry) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!sO!", &uri, &uri_len, &name, &name_len, &node, dom_documenttype_class_entry) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -933,7 +933,7 @@ PHP_METHOD(DOMElement, getElementsByTagNameNS)
|
||||
xmlChar *local, *nsuri;
|
||||
|
||||
id = ZEND_THIS;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &uri, &uri_len, &name, &name_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
@@ -942,7 +942,7 @@ PHP_METHOD(DOMElement, getElementsByTagNameNS)
|
||||
php_dom_create_iterator(return_value, DOM_NODELIST);
|
||||
namednode = Z_DOMOBJ_P(return_value);
|
||||
local = xmlCharStrndup(name, name_len);
|
||||
nsuri = xmlCharStrndup(uri, uri_len);
|
||||
nsuri = xmlCharStrndup(uri ? uri : "", uri_len);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri);
|
||||
|
||||
}
|
||||
|
||||
@@ -374,10 +374,6 @@ void dom_child_node_remove(dom_object *context)
|
||||
xmlNodePtr children;
|
||||
int stricterror;
|
||||
|
||||
if (dom_node_children_valid(child) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
stricterror = dom_get_strict_error(context->document);
|
||||
|
||||
if (dom_node_is_read_only(child) == SUCCESS ||
|
||||
@@ -391,6 +387,10 @@ void dom_child_node_remove(dom_object *context)
|
||||
return;
|
||||
}
|
||||
|
||||
if (dom_node_children_valid(child->parent) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
children = child->parent->children;
|
||||
if (!children) {
|
||||
php_dom_throw_error(NOT_FOUND_ERR, stricterror);
|
||||
|
||||
+7
-3
@@ -1243,9 +1243,13 @@ int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child)
|
||||
{
|
||||
xmlNodePtr nodep;
|
||||
|
||||
if (parent == NULL || child == NULL || child->doc != parent->doc) {
|
||||
return SUCCESS;
|
||||
}
|
||||
if (parent == NULL || child == NULL || child->doc != parent->doc) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (child->type == XML_DOCUMENT_NODE) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
nodep = parent;
|
||||
|
||||
|
||||
+18
-14
@@ -2,16 +2,16 @@
|
||||
|
||||
/** @generate-function-entries */
|
||||
|
||||
class DOMDocumentType
|
||||
class DOMDocumentType extends DOMNode
|
||||
{
|
||||
}
|
||||
|
||||
class DOMCdataSection
|
||||
class DOMCdataSection extends DOMText
|
||||
{
|
||||
public function __construct(string $data) {}
|
||||
}
|
||||
|
||||
class DOMComment
|
||||
class DOMComment extends DOMCharacterData
|
||||
{
|
||||
public function __construct(string $data = "") {}
|
||||
}
|
||||
@@ -93,6 +93,10 @@ class DOMNode
|
||||
public function replaceChild(DOMNode $node, DOMNode $child) {}
|
||||
}
|
||||
|
||||
class DOMNameSpaceNode
|
||||
{
|
||||
}
|
||||
|
||||
class DOMImplementation
|
||||
{
|
||||
/** @return void */
|
||||
@@ -105,10 +109,10 @@ class DOMImplementation
|
||||
public function createDocumentType(string $qualifiedName, string $publicId = "", string $systemId = "") {}
|
||||
|
||||
/** @return DOMDocument|false */
|
||||
public function createDocument(string $namespace = "", string $qualifiedName = "", ?DOMDocumentType $doctype = null) {}
|
||||
public function createDocument(?string $namespace = null, string $qualifiedName = "", ?DOMDocumentType $doctype = null) {}
|
||||
}
|
||||
|
||||
class DOMDocumentFragment implements DOMParentNode
|
||||
class DOMDocumentFragment extends DOMNode implements DOMParentNode
|
||||
{
|
||||
public function __construct() {}
|
||||
|
||||
@@ -133,7 +137,7 @@ class DOMNodeList implements IteratorAggregate, Countable
|
||||
public function item(int $index) {}
|
||||
}
|
||||
|
||||
class DOMCharacterData implements DOMChildNode
|
||||
class DOMCharacterData extends DOMNode implements DOMChildNode
|
||||
{
|
||||
/** @return bool */
|
||||
public function appendData(string $data) {}
|
||||
@@ -162,7 +166,7 @@ class DOMCharacterData implements DOMChildNode
|
||||
public function after(...$nodes): void {}
|
||||
}
|
||||
|
||||
class DOMAttr
|
||||
class DOMAttr extends DOMNode
|
||||
{
|
||||
public function __construct(string $name, string $value = "") {}
|
||||
|
||||
@@ -170,7 +174,7 @@ class DOMAttr
|
||||
public function isId() {}
|
||||
}
|
||||
|
||||
class DOMElement implements DOMParentNode, DOMChildNode
|
||||
class DOMElement extends DOMNode implements DOMParentNode, DOMChildNode
|
||||
{
|
||||
public function __construct(string $qualifiedName, ?string $value = null, string $namespace = "") {}
|
||||
|
||||
@@ -190,7 +194,7 @@ class DOMElement implements DOMParentNode, DOMChildNode
|
||||
public function getElementsByTagName(string $qualifiedName) {}
|
||||
|
||||
/** @return DOMNodeList */
|
||||
public function getElementsByTagNameNS(string $namespace, string $localName) {}
|
||||
public function getElementsByTagNameNS(?string $namespace, string $localName) {}
|
||||
|
||||
/** @return bool */
|
||||
public function hasAttribute(string $qualifiedName) {}
|
||||
@@ -246,7 +250,7 @@ class DOMElement implements DOMParentNode, DOMChildNode
|
||||
public function prepend(...$nodes): void {}
|
||||
}
|
||||
|
||||
class DOMDocument implements DOMParentNode
|
||||
class DOMDocument extends DOMNode implements DOMParentNode
|
||||
{
|
||||
public function __construct(string $version = "1.0", string $encoding = "") {}
|
||||
|
||||
@@ -287,7 +291,7 @@ class DOMDocument implements DOMParentNode
|
||||
public function getElementsByTagName(string $qualifiedName) {}
|
||||
|
||||
/** @return DOMNodeList */
|
||||
public function getElementsByTagNameNS(string $namespace, string $localName) {}
|
||||
public function getElementsByTagNameNS(?string $namespace, string $localName) {}
|
||||
|
||||
/** @return DOMNode|false */
|
||||
public function importNode(DOMNode $node, bool $deep = false) {}
|
||||
@@ -358,7 +362,7 @@ final class DOMException extends Exception
|
||||
{
|
||||
}
|
||||
|
||||
class DOMText
|
||||
class DOMText extends DOMCharacterData
|
||||
{
|
||||
public function __construct(string $data = "") {}
|
||||
|
||||
@@ -396,7 +400,7 @@ class DOMEntity extends DOMNode
|
||||
{
|
||||
}
|
||||
|
||||
class DOMEntityReference
|
||||
class DOMEntityReference extends DOMNode
|
||||
{
|
||||
public function __construct(string $name) {}
|
||||
}
|
||||
@@ -405,7 +409,7 @@ class DOMNotation extends DOMNode
|
||||
{
|
||||
}
|
||||
|
||||
class DOMProcessingInstruction
|
||||
class DOMProcessingInstruction extends DOMNode
|
||||
{
|
||||
public function __construct(string $name, string $value = "") {}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 7cba1a7a34cc4789871faf44fc4794a48db26e61 */
|
||||
* Stub hash: a4767d6ea60859c8897f681fb69d6f73b1f50471 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_dom_import_simplexml, 0, 1, DOMElement, 1)
|
||||
ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0)
|
||||
@@ -106,7 +106,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMImplementation_createDocumentType, 0, 0,
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMImplementation_createDocument, 0, 0, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, namespace, IS_STRING, 0, "\"\"")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, namespace, IS_STRING, 1, "null")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, qualifiedName, IS_STRING, 0, "\"\"")
|
||||
ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, doctype, DOMDocumentType, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -184,10 +184,7 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_class_DOMElement_getElementsByTagName arginfo_class_DOMElement_getAttribute
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement_getElementsByTagNameNS, 0, 0, 2)
|
||||
ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, localName, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
#define arginfo_class_DOMElement_getElementsByTagNameNS arginfo_class_DOMElement_getAttributeNS
|
||||
|
||||
#define arginfo_class_DOMElement_hasAttribute arginfo_class_DOMElement_getAttribute
|
||||
|
||||
@@ -292,7 +289,7 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_class_DOMDocument_getElementsByTagName arginfo_class_DOMElement_getAttribute
|
||||
|
||||
#define arginfo_class_DOMDocument_getElementsByTagNameNS arginfo_class_DOMElement_getElementsByTagNameNS
|
||||
#define arginfo_class_DOMDocument_getElementsByTagNameNS arginfo_class_DOMElement_getAttributeNS
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_importNode, 0, 0, 1)
|
||||
ZEND_ARG_OBJ_INFO(0, node, DOMNode, 0)
|
||||
@@ -649,6 +646,11 @@ static const zend_function_entry class_DOMNode_methods[] = {
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_DOMNameSpaceNode_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_DOMImplementation_methods[] = {
|
||||
ZEND_ME(DOMImplementation, getFeature, arginfo_class_DOMImplementation_getFeature, ZEND_ACC_PUBLIC)
|
||||
ZEND_ME(DOMImplementation, hasFeature, arginfo_class_DOMImplementation_hasFeature, ZEND_ACC_PUBLIC)
|
||||
|
||||
@@ -9,7 +9,7 @@ require_once __DIR__ .'/skipif.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$filename = __DIR__."/tmp_savehtmlfile".time().".html";
|
||||
$filename = __DIR__."/DOMDocument_saveHTMLFile_basic.html";
|
||||
$doc = new DOMDocument('1.0');
|
||||
$root = $doc->createElement('html');
|
||||
$root = $doc->appendChild($root);
|
||||
|
||||
@@ -9,7 +9,7 @@ require_once __DIR__ .'/skipif.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$filename = __DIR__."/tmp_savehtmlfile".time().".html";
|
||||
$filename = __DIR__."/DOMDocument_saveHTMLFile_formatOutput.html";
|
||||
$doc = new DOMDocument('1.0');
|
||||
$doc->formatOutput = true;
|
||||
$root = $doc->createElement('html');
|
||||
|
||||
@@ -6,6 +6,7 @@ include('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
$x = new DOMImplementation();
|
||||
$doc = $x->createDocument(null, 'html');
|
||||
echo $doc->saveHTML();
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #66783 (UAF when appending DOMDocument to element)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('dom')) die('skip dom extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$doc = new DomDocument;
|
||||
$doc->loadXML('<root></root>');
|
||||
$e = $doc->createElement('e');
|
||||
try {
|
||||
$e->appendChild($doc);
|
||||
} catch (DOMException $ex) {
|
||||
echo $ex->getMessage(), PHP_EOL;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Hierarchy Request Error
|
||||
@@ -6,13 +6,24 @@ require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadXML('<root xmlns:x="x"><a/><x:a/></root>');
|
||||
$list = $doc->getElementsByTagNameNS('', 'a');
|
||||
var_dump($list->length);
|
||||
$list = $doc->getElementsByTagNameNS(null, 'a');
|
||||
var_dump($list->length);
|
||||
|
||||
$elem = $doc->documentElement;
|
||||
$list = $elem->getElementsByTagNameNS('', 'a');
|
||||
var_dump($list->length);
|
||||
$list = $elem->getElementsByTagNameNS(null, 'a');
|
||||
var_dump($list->length);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
@@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Bug #79852: count(DOMNodeList) doesn't match count(IteratorIterator(DOMNodeList))
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
dom: DOMChildNode::remove does not work on character data
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$doc = new \DOMDocument();
|
||||
$doc->loadXML('<a><!-- foo --></a>');
|
||||
$doc->documentElement->firstChild->remove();
|
||||
echo $doc->saveXML($doc->documentElement);
|
||||
--EXPECTF--
|
||||
<a/>
|
||||
@@ -199,6 +199,7 @@ PHP_MINIT_FUNCTION(enchant)
|
||||
enchant_broker_handlers.offset = XtOffsetOf(enchant_broker, std);
|
||||
enchant_broker_handlers.free_obj = php_enchant_broker_free;
|
||||
enchant_broker_handlers.clone_obj = NULL;
|
||||
enchant_broker_handlers.compare = zend_objects_not_comparable;
|
||||
|
||||
INIT_CLASS_ENTRY(dce, "EnchantDictionary", class_EnchantDictionary_methods);
|
||||
enchant_dict_ce = zend_register_internal_class(&dce);
|
||||
@@ -211,6 +212,7 @@ PHP_MINIT_FUNCTION(enchant)
|
||||
enchant_dict_handlers.offset = XtOffsetOf(enchant_dict, std);
|
||||
enchant_dict_handlers.free_obj = php_enchant_dict_free;
|
||||
enchant_dict_handlers.clone_obj = NULL;
|
||||
enchant_dict_handlers.compare = zend_objects_not_comparable;
|
||||
|
||||
REGISTER_LONG_CONSTANT("ENCHANT_MYSPELL", PHP_ENCHANT_MYSPELL, CONST_CS | CONST_PERSISTENT | CONST_DEPRECATED);
|
||||
REGISTER_LONG_CONSTANT("ENCHANT_ISPELL", PHP_ENCHANT_ISPELL, CONST_CS | CONST_PERSISTENT | CONST_DEPRECATED);
|
||||
|
||||
+53
-34
@@ -293,57 +293,85 @@ static int zend_ffi_is_compatible_type(zend_ffi_type *dst_type, zend_ffi_type *s
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static ffi_type *zend_ffi_make_fake_struct_type(zend_ffi_type *type) /* {{{ */
|
||||
static ffi_type* zend_ffi_face_struct_add_fields(ffi_type* t, zend_ffi_type *type, int *i, size_t size)
|
||||
{
|
||||
ffi_type *t = emalloc(sizeof(ffi_type) + sizeof(ffi_type*) * (zend_hash_num_elements(&type->record.fields) + 1));
|
||||
int i;
|
||||
zend_ffi_field *field;
|
||||
|
||||
t->size = type->size;
|
||||
t->alignment = type->align;
|
||||
t->type = FFI_TYPE_STRUCT;
|
||||
t->elements = (ffi_type**)(t + 1);
|
||||
i = 0;
|
||||
ZEND_HASH_FOREACH_PTR(&type->record.fields, field) {
|
||||
switch (ZEND_FFI_TYPE(field->type)->kind) {
|
||||
case ZEND_FFI_TYPE_FLOAT:
|
||||
t->elements[i] = &ffi_type_float;
|
||||
t->elements[(*i)++] = &ffi_type_float;
|
||||
break;
|
||||
case ZEND_FFI_TYPE_DOUBLE:
|
||||
t->elements[i] = &ffi_type_double;
|
||||
t->elements[(*i)++] = &ffi_type_double;
|
||||
break;
|
||||
#ifdef HAVE_LONG_DOUBLE
|
||||
case ZEND_FFI_TYPE_LONGDOUBLE:
|
||||
t->elements[i] = &ffi_type_longdouble;
|
||||
t->elements[(*i)++] = &ffi_type_longdouble;
|
||||
break;
|
||||
#endif
|
||||
case ZEND_FFI_TYPE_SINT8:
|
||||
case ZEND_FFI_TYPE_UINT8:
|
||||
case ZEND_FFI_TYPE_BOOL:
|
||||
case ZEND_FFI_TYPE_CHAR:
|
||||
t->elements[i] = &ffi_type_uint8;
|
||||
t->elements[(*i)++] = &ffi_type_uint8;
|
||||
break;
|
||||
case ZEND_FFI_TYPE_SINT16:
|
||||
case ZEND_FFI_TYPE_UINT16:
|
||||
t->elements[i] = &ffi_type_uint16;
|
||||
t->elements[(*i)++] = &ffi_type_uint16;
|
||||
break;
|
||||
case ZEND_FFI_TYPE_SINT32:
|
||||
case ZEND_FFI_TYPE_UINT32:
|
||||
t->elements[i] = &ffi_type_uint32;
|
||||
t->elements[(*i)++] = &ffi_type_uint32;
|
||||
break;
|
||||
case ZEND_FFI_TYPE_SINT64:
|
||||
case ZEND_FFI_TYPE_UINT64:
|
||||
t->elements[i] = &ffi_type_uint64;
|
||||
t->elements[(*i)++] = &ffi_type_uint64;
|
||||
break;
|
||||
case ZEND_FFI_TYPE_POINTER:
|
||||
t->elements[i] = &ffi_type_pointer;
|
||||
t->elements[(*i)++] = &ffi_type_pointer;
|
||||
break;
|
||||
case ZEND_FFI_TYPE_STRUCT: {
|
||||
zend_ffi_type *field_type = ZEND_FFI_TYPE(field->type);
|
||||
/* for unions we use only the first field */
|
||||
int num_fields = !(field_type->attr & ZEND_FFI_ATTR_UNION) ?
|
||||
zend_hash_num_elements(&field_type->record.fields) : 1;
|
||||
|
||||
if (num_fields > 1) {
|
||||
size += sizeof(ffi_type*) * (num_fields - 1);
|
||||
t = erealloc(t, size);
|
||||
t->elements = (ffi_type**)(t + 1);
|
||||
}
|
||||
t = zend_ffi_face_struct_add_fields(t, field_type, i, size);
|
||||
break;
|
||||
default:
|
||||
efree(t);
|
||||
return NULL;
|
||||
}
|
||||
i++;
|
||||
default:
|
||||
t->elements[(*i)++] = &ffi_type_void;
|
||||
break;
|
||||
}
|
||||
if (type->attr & ZEND_FFI_ATTR_UNION) {
|
||||
/* for unions we use only the first field */
|
||||
break;
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
return t;
|
||||
}
|
||||
|
||||
static ffi_type *zend_ffi_make_fake_struct_type(zend_ffi_type *type) /* {{{ */
|
||||
{
|
||||
/* for unions we use only the first field */
|
||||
int num_fields = !(type->attr & ZEND_FFI_ATTR_UNION) ?
|
||||
zend_hash_num_elements(&type->record.fields) : 1;
|
||||
size_t size = sizeof(ffi_type) + sizeof(ffi_type*) * (num_fields + 1);
|
||||
ffi_type *t = emalloc(size);
|
||||
int i;
|
||||
|
||||
t->size = type->size;
|
||||
t->alignment = type->align;
|
||||
t->type = FFI_TYPE_STRUCT;
|
||||
t->elements = (ffi_type**)(t + 1);
|
||||
i = 0;
|
||||
t = zend_ffi_face_struct_add_fields(t, type, &i, size);
|
||||
t->elements[i] = NULL;
|
||||
return t;
|
||||
}
|
||||
@@ -391,11 +419,7 @@ again:
|
||||
kind = type->enumeration.kind;
|
||||
goto again;
|
||||
case ZEND_FFI_TYPE_STRUCT:
|
||||
if (!(type->attr & ZEND_FFI_ATTR_UNION)) {
|
||||
ffi_type *t = zend_ffi_make_fake_struct_type(type);
|
||||
return t;
|
||||
}
|
||||
break;
|
||||
return zend_ffi_make_fake_struct_type(type);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -2534,18 +2558,13 @@ again:
|
||||
kind = type->enumeration.kind;
|
||||
goto again;
|
||||
case ZEND_FFI_TYPE_STRUCT:
|
||||
if (!(type->attr & ZEND_FFI_ATTR_UNION)
|
||||
&& Z_TYPE_P(arg) == IS_OBJECT && Z_OBJCE_P(arg) == zend_ffi_cdata_ce) {
|
||||
if (Z_TYPE_P(arg) == IS_OBJECT && Z_OBJCE_P(arg) == zend_ffi_cdata_ce) {
|
||||
zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(arg);
|
||||
|
||||
if (zend_ffi_is_compatible_type(type, ZEND_FFI_TYPE(cdata->type))) {
|
||||
/* Create a fake structure type */
|
||||
ffi_type *t = zend_ffi_make_fake_struct_type(type);
|
||||
if (t) {
|
||||
*pass_type = t;
|
||||
arg_values[n] = cdata->ptr;
|
||||
break;
|
||||
}
|
||||
*pass_type = zend_ffi_make_fake_struct_type(type);;
|
||||
arg_values[n] = cdata->ptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
zend_ffi_pass_incompatible(arg, type, n, execute_data);
|
||||
|
||||
@@ -68,8 +68,17 @@ final class FFI
|
||||
|
||||
namespace FFI {
|
||||
|
||||
final class CData {
|
||||
}
|
||||
|
||||
final class CType {
|
||||
public function getName() : string {}
|
||||
}
|
||||
|
||||
class Exception extends \Error {
|
||||
}
|
||||
|
||||
final class ParserException extends Exception {
|
||||
}
|
||||
|
||||
}
|
||||
+16
-1
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 5aeec68fea7a94cd643464acfb10bf4cfcc863da */
|
||||
* Stub hash: b01d17eaac68e56d3f2c2c2bc86d44bcc8ea7c26 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_cdef, 0, 0, FFI, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, code, IS_STRING, 0, "\"\"")
|
||||
@@ -125,7 +125,22 @@ static const zend_function_entry class_FFI_methods[] = {
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_FFI_CData_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_FFI_CType_methods[] = {
|
||||
ZEND_ME(FFI_CType, getName, arginfo_class_FFI_CType_getName, ZEND_ACC_PUBLIC)
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_FFI_Exception_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_FFI_ParserException_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
@@ -0,0 +1,68 @@
|
||||
--TEST--
|
||||
Bug #80847 (Nested structs)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('ffi')) die('skip ffi extension not available');
|
||||
if (!extension_loaded('zend-test')) die('skip zend-test extension not available');
|
||||
if (PHP_OS_FAMILY == 'Windows' && ((1 << 31) > 0)) die('xfail libffi doesn\'t properly support passing big strctures by value on Windows/64');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once('utils.inc');
|
||||
$header = <<<HEADER
|
||||
typedef struct bug80847_01 {
|
||||
uint64_t b;
|
||||
double c;
|
||||
} bug80847_01;
|
||||
|
||||
typedef struct bug80847_02 {
|
||||
bug80847_01 a;
|
||||
} bug80847_02;
|
||||
|
||||
bug80847_02 ffi_bug80847(bug80847_02 s);
|
||||
HEADER;
|
||||
|
||||
if (PHP_OS_FAMILY !== 'Windows') {
|
||||
$ffi = FFI::cdef($header);
|
||||
} else {
|
||||
try {
|
||||
$ffi = FFI::cdef($header, 'php_zend_test.dll');
|
||||
} catch (FFI\Exception $ex) {
|
||||
$ffi = FFI::cdef($header, ffi_get_php_dll_name());
|
||||
}
|
||||
}
|
||||
$x = $ffi->new('bug80847_02');
|
||||
$x->a->b = 42;
|
||||
$x->a->c = 42.5;
|
||||
var_dump($x);
|
||||
$y = $ffi->ffi_bug80847($x);
|
||||
var_dump($x, $y);
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(FFI\CData:struct bug80847_02)#%d (1) {
|
||||
["a"]=>
|
||||
object(FFI\CData:struct bug80847_01)#%d (2) {
|
||||
["b"]=>
|
||||
int(42)
|
||||
["c"]=>
|
||||
float(42.5)
|
||||
}
|
||||
}
|
||||
object(FFI\CData:struct bug80847_02)#%d (1) {
|
||||
["a"]=>
|
||||
object(FFI\CData:struct bug80847_01)#%d (2) {
|
||||
["b"]=>
|
||||
int(42)
|
||||
["c"]=>
|
||||
float(42.5)
|
||||
}
|
||||
}
|
||||
object(FFI\CData:struct bug80847_02)#%d (1) {
|
||||
["a"]=>
|
||||
object(FFI\CData:struct bug80847_01)#%d (2) {
|
||||
["b"]=>
|
||||
int(52)
|
||||
["c"]=>
|
||||
float(32.5)
|
||||
}
|
||||
}
|
||||
@@ -215,7 +215,7 @@ PHP_FUNCTION(finfo_open)
|
||||
char resolved_path[MAXPATHLEN];
|
||||
zend_error_handling zeh;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lp", &options, &file, &file_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lp!", &options, &file, &file_len) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
class finfo
|
||||
{
|
||||
/** @alias finfo_open */
|
||||
public function __construct(int $flags = FILEINFO_NONE, string $magic_database = "") {}
|
||||
public function __construct(int $flags = FILEINFO_NONE, ?string $magic_database = null) {}
|
||||
|
||||
/**
|
||||
* @param resource|null $context
|
||||
@@ -29,7 +29,7 @@ class finfo
|
||||
}
|
||||
|
||||
/** @return resource|false */
|
||||
function finfo_open(int $flags = FILEINFO_NONE, string $magic_database = "") {}
|
||||
function finfo_open(int $flags = FILEINFO_NONE, ?string $magic_database = null) {}
|
||||
|
||||
/**
|
||||
* @param resource $finfo
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: be858509df27550b51d8a7a51a3629eceb6d0aa6 */
|
||||
* Stub hash: 648085986695281bd5a8fb536d5ec6c2a9f8c6e8 */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_open, 0, 0, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, magic_database, IS_STRING, 0, "\"\"")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, magic_database, IS_STRING, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_finfo_close, 0, 1, _IS_BOOL, 0)
|
||||
|
||||
@@ -1886,6 +1886,12 @@ static void ftp_ssl_shutdown(ftpbuf_t *ftp, php_socket_t fd, SSL *ssl_handle) {
|
||||
/* SSL wants a write. Really odd. Let's bail out. */
|
||||
done = 1;
|
||||
break;
|
||||
case SSL_ERROR_SYSCALL:
|
||||
/* most likely the peer closed the connection without
|
||||
sending a close_notify shutdown alert;
|
||||
bail out to avoid raising a spurious warning */
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
if ((sslerror = ERR_get_error())) {
|
||||
ERR_error_string_n(sslerror, buf, sizeof(buf));
|
||||
|
||||
+22
-15
@@ -232,6 +232,7 @@ static void php_gd_object_minit_helper()
|
||||
php_gd_image_object_handlers.clone_obj = NULL;
|
||||
php_gd_image_object_handlers.free_obj = php_gd_image_object_free;
|
||||
php_gd_image_object_handlers.get_constructor = php_gd_image_object_get_constructor;
|
||||
php_gd_image_object_handlers.compare = zend_objects_not_comparable;
|
||||
php_gd_image_object_handlers.offset = XtOffsetOf(php_gd_image_object, std);
|
||||
}
|
||||
|
||||
@@ -1778,7 +1779,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
char *file = NULL;
|
||||
zend_long quality = 0, type = 0;
|
||||
gdImagePtr im;
|
||||
char *fn = NULL;
|
||||
FILE *fp;
|
||||
size_t file_len = 0;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
@@ -1786,28 +1786,35 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
|
||||
/* The quality parameter for gd2 stands for chunk size */
|
||||
|
||||
if (zend_parse_parameters(argc, "O|pll", &imgind, gd_image_ce, &file, &file_len, &quality, &type) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
switch (image_type) {
|
||||
case PHP_GDIMG_TYPE_GD:
|
||||
if (zend_parse_parameters(argc, "O|p!", &imgind, gd_image_ce, &file, &file_len) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
break;
|
||||
case PHP_GDIMG_TYPE_GD2:
|
||||
if (zend_parse_parameters(argc, "O|p!ll", &imgind, gd_image_ce, &file, &file_len, &quality, &type) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
break;
|
||||
EMPTY_SWITCH_DEFAULT_CASE()
|
||||
}
|
||||
|
||||
im = php_gd_libgdimageptr_from_zval_p(imgind);
|
||||
|
||||
if (argc > 1) {
|
||||
fn = file;
|
||||
if (argc >= 3) {
|
||||
q = quality;
|
||||
if (argc == 4) {
|
||||
t = type;
|
||||
}
|
||||
if (argc >= 3) {
|
||||
q = quality;
|
||||
if (argc == 4) {
|
||||
t = type;
|
||||
}
|
||||
}
|
||||
|
||||
if (argc >= 2 && file_len) {
|
||||
PHP_GD_CHECK_OPEN_BASEDIR(fn, "Invalid filename");
|
||||
if (file_len) {
|
||||
PHP_GD_CHECK_OPEN_BASEDIR(file, "Invalid filename");
|
||||
|
||||
fp = VCWD_FOPEN(fn, "wb");
|
||||
fp = VCWD_FOPEN(file, "wb");
|
||||
if (!fp) {
|
||||
php_error_docref(NULL, E_WARNING, "Unable to open \"%s\" for writing", fn);
|
||||
php_error_docref(NULL, E_WARNING, "Unable to open \"%s\" for writing", file);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -2594,7 +2601,7 @@ PHP_FUNCTION(imageinterlace)
|
||||
gdImageInterlace(im, INT);
|
||||
}
|
||||
|
||||
RETURN_LONG(gdImageGetInterlaced(im));
|
||||
RETURN_BOOL(gdImageGetInterlaced(im));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
+4
-4
@@ -124,9 +124,9 @@ function imagejpeg(GdImage $image, $file = null, int $quality = -1): bool {}
|
||||
/** @param resource|string|null $file */
|
||||
function imagewbmp(GdImage $image, $file = null, ?int $foreground_color = null): bool {}
|
||||
|
||||
function imagegd(GdImage $image, string $file = UNKNOWN): bool {}
|
||||
function imagegd(GdImage $image, ?string $file = null): bool {}
|
||||
|
||||
function imagegd2(GdImage $image, string $file = UNKNOWN, int $chunk_size = UNKNOWN, int $mode = UNKNOWN): bool {}
|
||||
function imagegd2(GdImage $image, ?string $file = null, int $chunk_size = UNKNOWN, int $mode = UNKNOWN): bool {}
|
||||
|
||||
#ifdef HAVE_GD_BMP
|
||||
/** @param resource|string|null $file */
|
||||
@@ -177,9 +177,9 @@ function imagefill(GdImage $image, int $x, int $y, int $color): bool {}
|
||||
|
||||
function imagecolorstotal(GdImage $image): int {}
|
||||
|
||||
function imagecolortransparent(GdImage $image, ?int $color = null): ?int {}
|
||||
function imagecolortransparent(GdImage $image, ?int $color = null): int {}
|
||||
|
||||
function imageinterlace(GdImage $image, ?bool $enable = null): ?int {}
|
||||
function imageinterlace(GdImage $image, ?bool $enable = null): bool {}
|
||||
|
||||
function imagepolygon(GdImage $image, array $points, int $num_points_or_color, ?int $color = null): bool {}
|
||||
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 59256d0de105f1a2f5d5fc1e20f8090031b42a76 */
|
||||
* Stub hash: 012a149dba5332fcb73544771b881fc7e6d53925 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gd_info, 0, 0, IS_ARRAY, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -238,12 +238,12 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegd, 0, 1, _IS_BOOL, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, image, GdImage, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, file, IS_STRING, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegd2, 0, 1, _IS_BOOL, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, image, GdImage, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, file, IS_STRING, 1, "null")
|
||||
ZEND_ARG_TYPE_INFO(0, chunk_size, IS_LONG, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -358,12 +358,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolorstotal, 0, 1, IS_LONG,
|
||||
ZEND_ARG_OBJ_INFO(0, image, GdImage, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolortransparent, 0, 1, IS_LONG, 1)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolortransparent, 0, 1, IS_LONG, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, image, GdImage, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, color, IS_LONG, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageinterlace, 0, 1, IS_LONG, 1)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageinterlace, 0, 1, _IS_BOOL, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, image, GdImage, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, enable, _IS_BOOL, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
@@ -8,14 +8,14 @@ if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
<?php
|
||||
$im = imagecreatetruecolor(10, 10);
|
||||
imagefilledrectangle($im, 0, 0, 9, 9, imagecolorallocate($im, 255, 255, 255));
|
||||
imageinterlace($im, 1);
|
||||
imageinterlace($im, true);
|
||||
imagegif($im, __DIR__ . 'bug77700.gif');
|
||||
|
||||
$im = imagecreatefromgif(__DIR__ . 'bug77700.gif');
|
||||
var_dump(imageinterlace($im));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
bool(true)
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__ . 'bug77700.gif');
|
||||
|
||||
@@ -14,4 +14,4 @@ $image = imagecreatetruecolor(100, 100);
|
||||
var_dump(imageinterlace($image));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
bool(false)
|
||||
@@ -12,9 +12,9 @@ if (!extension_loaded("gd")) die("skip GD not present");
|
||||
|
||||
$image = imagecreatetruecolor(100, 100);
|
||||
|
||||
var_dump(imageinterlace($image, 1));
|
||||
var_dump(imageinterlace($image, true));
|
||||
var_dump(imageinterlace($image));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(1)
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -13,12 +13,12 @@ if (!extension_loaded("gd")) die("skip GD not present");
|
||||
$image = imagecreatetruecolor(100, 100);
|
||||
|
||||
//setting the interlace bit to on
|
||||
imageinterlace($image, 1);
|
||||
imageinterlace($image, true);
|
||||
|
||||
//setting de interlace bit to off
|
||||
var_dump(imageinterlace($image, 0));
|
||||
var_dump(imageinterlace($image, false));
|
||||
var_dump(imageinterlace($image));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
int(0)
|
||||
bool(false)
|
||||
bool(false)
|
||||
+66
-2
@@ -735,7 +735,11 @@ PHP_FUNCTION(imap_open)
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (flags && ((flags & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | CL_EXPUNGE | OP_DEBUG | OP_SHORTCACHE
|
||||
/* Check for PHP_EXPUNGE and not CL_EXPUNGE as the user land facing CL_EXPUNGE constant is defined
|
||||
* to something different to prevent clashes between CL_EXPUNGE and an OP_* constant allowing setting
|
||||
* the CL_EXPUNGE flag which will expunge when the mailbox is closed (be that manually, or via the
|
||||
* IMAPConnection object being destroyed naturally at the end of the PHP script */
|
||||
if (flags && ((flags & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | PHP_EXPUNGE | OP_DEBUG | OP_SHORTCACHE
|
||||
| OP_SILENT | OP_PROTOTYPE | OP_SECURE)) != 0)) {
|
||||
zend_argument_value_error(4, "must be a bitmask of the OP_* constants, and CL_EXPUNGE");
|
||||
RETURN_THROWS();
|
||||
@@ -858,7 +862,11 @@ PHP_FUNCTION(imap_reopen)
|
||||
}
|
||||
|
||||
/* TODO Verify these are the only options available as they are pulled from the php.net documentation */
|
||||
if (options && ((options & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | OP_EXPUNGE | CL_EXPUNGE)) != 0)) {
|
||||
/* Check for PHP_EXPUNGE and not CL_EXPUNGE as the user land facing CL_EXPUNGE constant is defined
|
||||
* to something different to prevent clashes between CL_EXPUNGE and an OP_* constant allowing setting
|
||||
* the CL_EXPUNGE flag which will expunge when the mailbox is closed (be that manually, or via the
|
||||
* IMAPConnection object being destroyed naturally at the end of the PHP script */
|
||||
if (options && ((options & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | OP_EXPUNGE | PHP_EXPUNGE)) != 0)) {
|
||||
zend_argument_value_error(3, "must be a bitmask of OP_READONLY, OP_ANONYMOUS, OP_HALFOPEN, "
|
||||
"OP_EXPUNGE, and CL_EXPUNGE");
|
||||
RETURN_THROWS();
|
||||
@@ -3055,6 +3063,23 @@ PHP_FUNCTION(imap_fetch_overview)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static zend_bool header_injection(zend_string *str, zend_bool adrlist)
|
||||
{
|
||||
char *p = ZSTR_VAL(str);
|
||||
|
||||
while ((p = strpbrk(p, "\r\n")) != NULL) {
|
||||
if (!(p[0] == '\r' && p[1] == '\n')
|
||||
/* adrlists do not support folding, but swallow trailing line breaks */
|
||||
&& !((adrlist && p[1] == '\0')
|
||||
/* other headers support folding */
|
||||
|| !adrlist && (p[1] == ' ' || p[1] == '\t'))) {
|
||||
return 1;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* {{{ Create a MIME message based on given envelope and body sections */
|
||||
PHP_FUNCTION(imap_mail_compose)
|
||||
{
|
||||
@@ -3078,6 +3103,13 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
zend_argument_value_error(2, "cannot be empty");
|
||||
}
|
||||
|
||||
#define CHECK_HEADER_INJECTION(zstr, adrlist, header) \
|
||||
if (header_injection(zstr, adrlist)) { \
|
||||
php_error_docref(NULL, E_WARNING, "header injection attempt in " header); \
|
||||
RETVAL_FALSE; \
|
||||
goto done; \
|
||||
}
|
||||
|
||||
#define PHP_RFC822_PARSE_ADRLIST(target, value) \
|
||||
str_copy = estrndup(Z_STRVAL_P(value), Z_STRLEN_P(value)); \
|
||||
rfc822_parse_adrlist(target, str_copy, "NO HOST"); \
|
||||
@@ -3086,46 +3118,57 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
env = mail_newenvelope();
|
||||
if ((pvalue = zend_hash_str_find(envelope, "remail", sizeof("remail") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "remail");
|
||||
env->remail = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "return_path", sizeof("return_path") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "return_path");
|
||||
PHP_RFC822_PARSE_ADRLIST(&env->return_path, pvalue);
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "date", sizeof("date") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "date");
|
||||
env->date = (unsigned char*)cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "from", sizeof("from") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "from");
|
||||
PHP_RFC822_PARSE_ADRLIST(&env->from, pvalue);
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "reply_to", sizeof("reply_to") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "reply_to");
|
||||
PHP_RFC822_PARSE_ADRLIST(&env->reply_to, pvalue);
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "in_reply_to", sizeof("in_reply_to") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "in_reply_to");
|
||||
env->in_reply_to = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "subject", sizeof("subject") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "subject");
|
||||
env->subject = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "to", sizeof("to") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "to");
|
||||
PHP_RFC822_PARSE_ADRLIST(&env->to, pvalue);
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "cc", sizeof("cc") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "cc");
|
||||
PHP_RFC822_PARSE_ADRLIST(&env->cc, pvalue);
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "bcc", sizeof("bcc") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "bcc");
|
||||
PHP_RFC822_PARSE_ADRLIST(&env->bcc, pvalue);
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(envelope, "message_id", sizeof("message_id") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "message_id");
|
||||
env->message_id=cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
|
||||
@@ -3136,6 +3179,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pvalue), env_data) {
|
||||
custom_headers_param = mail_newbody_parameter();
|
||||
convert_to_string_ex(env_data);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(env_data), 0, "custom_headers");
|
||||
custom_headers_param->value = (char *) fs_get(Z_STRLEN_P(env_data) + 1);
|
||||
custom_headers_param->attribute = NULL;
|
||||
memcpy(custom_headers_param->value, Z_STRVAL_P(env_data), Z_STRLEN_P(env_data) + 1);
|
||||
@@ -3178,6 +3222,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body charset");
|
||||
tmp_param = mail_newbody_parameter();
|
||||
tmp_param->value = cpystr(Z_STRVAL_P(pvalue));
|
||||
tmp_param->attribute = cpystr("CHARSET");
|
||||
@@ -3190,9 +3235,11 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
CHECK_HEADER_INJECTION(key, 0, "body disposition key");
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body disposition value");
|
||||
disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1);
|
||||
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
|
||||
disp_param->next = tmp_param;
|
||||
@@ -3203,18 +3250,22 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "subtype", sizeof("subtype") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body subtype");
|
||||
bod->subtype = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "id", sizeof("id") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body id");
|
||||
bod->id = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "description", sizeof("description") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body description");
|
||||
bod->description = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body disposition.type");
|
||||
bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1);
|
||||
memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1);
|
||||
}
|
||||
@@ -3224,9 +3275,11 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
CHECK_HEADER_INJECTION(key, 0, "body type.parameters key");
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body type.parameters value");
|
||||
disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1);
|
||||
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
|
||||
disp_param->next = tmp_param;
|
||||
@@ -3257,6 +3310,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body md5");
|
||||
bod->md5 = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
} else if (Z_TYPE_P(data) == IS_ARRAY && topbod->type == TYPEMULTIPART) {
|
||||
@@ -3289,6 +3343,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body charset");
|
||||
tmp_param = mail_newbody_parameter();
|
||||
tmp_param->value = (char *) fs_get(Z_STRLEN_P(pvalue) + 1);
|
||||
memcpy(tmp_param->value, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1);
|
||||
@@ -3302,9 +3357,11 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
CHECK_HEADER_INJECTION(key, 0, "body type.parameters key");
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body type.parameters value");
|
||||
disp_param->value = (char *)fs_get(Z_STRLEN_P(disp_data) + 1);
|
||||
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
|
||||
disp_param->next = tmp_param;
|
||||
@@ -3315,18 +3372,22 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "subtype", sizeof("subtype") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body subtype");
|
||||
bod->subtype = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "id", sizeof("id") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body id");
|
||||
bod->id = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "description", sizeof("description") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body description");
|
||||
bod->description = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body disposition.type");
|
||||
bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1);
|
||||
memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1);
|
||||
}
|
||||
@@ -3336,9 +3397,11 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
CHECK_HEADER_INJECTION(key, 0, "body disposition key");
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body disposition value");
|
||||
disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1);
|
||||
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
|
||||
disp_param->next = tmp_param;
|
||||
@@ -3369,6 +3432,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body md5");
|
||||
bod->md5 = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
--TEST--
|
||||
Bug #80710 (imap_mail_compose() header injection) - MIME Splitting Attack
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("imap")) die("skip imap extension not available");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$envelope["from"]= "joe@example.com\n From : X-INJECTED";
|
||||
$envelope["to"] = "foo@example.com\nFrom: X-INJECTED";
|
||||
$envelope["cc"] = "bar@example.com\nFrom: X-INJECTED";
|
||||
$envelope["subject"] = "bar@example.com\n\n From : X-INJECTED";
|
||||
$envelope["x-remail"] = "bar@example.com\nFrom: X-INJECTED";
|
||||
$envelope["something"] = "bar@example.com\nFrom: X-INJECTED";
|
||||
|
||||
$part1["type"] = TYPEMULTIPART;
|
||||
$part1["subtype"] = "mixed";
|
||||
|
||||
$part2["type"] = TYPEAPPLICATION;
|
||||
$part2["encoding"] = ENCBINARY;
|
||||
$part2["subtype"] = "octet-stream\nContent-Type: X-INJECTED";
|
||||
$part2["description"] = "some file\nContent-Type: X-INJECTED";
|
||||
$part2["contents.data"] = "ABC\nContent-Type: X-INJECTED";
|
||||
|
||||
$part3["type"] = TYPETEXT;
|
||||
$part3["subtype"] = "plain";
|
||||
$part3["description"] = "description3";
|
||||
$part3["contents.data"] = "contents.data3\n\n\n\t";
|
||||
|
||||
$body[1] = $part1;
|
||||
$body[2] = $part2;
|
||||
$body[3] = $part3;
|
||||
|
||||
echo imap_mail_compose($envelope, $body);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imap_mail_compose(): header injection attempt in from in %s on line %d
|
||||
@@ -0,0 +1,37 @@
|
||||
--TEST--
|
||||
Bug #80710 (imap_mail_compose() header injection) - Remail
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("imap")) die("skip imap extension not available");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$envelope["from"]= "joe@example.com\n From : X-INJECTED";
|
||||
$envelope["to"] = "foo@example.com\nFrom: X-INJECTED";
|
||||
$envelope["cc"] = "bar@example.com\nFrom: X-INJECTED";
|
||||
$envelope["subject"] = "bar@example.com\n\n From : X-INJECTED";
|
||||
$envelope["remail"] = "X-INJECTED-REMAIL: X-INJECTED\nFrom: X-INJECTED-REMAIL-FROM"; //<--- Injected as first hdr
|
||||
$envelope["something"] = "bar@example.com\nFrom: X-INJECTED";
|
||||
|
||||
$part1["type"] = TYPEMULTIPART;
|
||||
$part1["subtype"] = "mixed";
|
||||
|
||||
$part2["type"] = TYPEAPPLICATION;
|
||||
$part2["encoding"] = ENCBINARY;
|
||||
$part2["subtype"] = "octet-stream\nContent-Type: X-INJECTED";
|
||||
$part2["description"] = "some file\nContent-Type: X-INJECTED";
|
||||
$part2["contents.data"] = "ABC\nContent-Type: X-INJECTED";
|
||||
|
||||
$part3["type"] = TYPETEXT;
|
||||
$part3["subtype"] = "plain";
|
||||
$part3["description"] = "description3";
|
||||
$part3["contents.data"] = "contents.data3\n\n\n\t";
|
||||
|
||||
$body[1] = $part1;
|
||||
$body[2] = $part2;
|
||||
$body[3] = $part3;
|
||||
|
||||
echo imap_mail_compose($envelope, $body);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imap_mail_compose(): header injection attempt in remail in %s on line %d
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #80800: imap_open() fails when the flags parameter includes CL_EXPUNGE
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(__DIR__.'/setup/skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once __DIR__.'/setup/imap_include.inc';
|
||||
|
||||
$mail_box = imap_open(IMAP_DEFAULT_MAILBOX, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD, flags: CL_EXPUNGE);
|
||||
var_dump(imap_reopen($mail_box, IMAP_DEFAULT_MAILBOX, flags: CL_EXPUNGE));
|
||||
imap_close($mail_box);
|
||||
|
||||
echo 'Connected without any issues', "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
Connected without any issues
|
||||
@@ -0,0 +1,43 @@
|
||||
--TEST--
|
||||
Test imap_open() using the CL_EXPUNGE flag
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(__DIR__.'/setup/skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// include file for required variables in imap_open()
|
||||
require_once(__DIR__.'/setup/imap_include.inc');
|
||||
|
||||
// set up temp mailbox with 3 messages
|
||||
$stream_id = setup_test_mailbox('imapopenwithclexpunge', 3, $mailbox, flags: CL_EXPUNGE);
|
||||
|
||||
// mark messages in inbox for deletion
|
||||
for ($i = 1; $i < 4; $i++) {
|
||||
imap_delete($stream_id, $i);
|
||||
}
|
||||
|
||||
echo "\n-- Call to imap_close() --\n";
|
||||
var_dump( imap_close($stream_id) );
|
||||
|
||||
// check that CL_EXPUNGE in previous imap_open() call worked
|
||||
$stream_id = imap_open($mailbox, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD);
|
||||
echo "There are now " . imap_num_msg($stream_id) . " msgs in mailbox '$mailbox'\n";
|
||||
|
||||
// Close connection
|
||||
var_dump( imap_close($stream_id) );
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
$mailbox_suffix = 'imapopenwithclexpunge';
|
||||
require_once(__DIR__.'/setup/clean.inc');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Create a temporary mailbox and add 3 msgs
|
||||
New mailbox created
|
||||
|
||||
-- Call to imap_close() --
|
||||
bool(true)
|
||||
There are now 0 msgs in mailbox '%sINBOX.phpttestimapopenwithclexpunge'
|
||||
bool(true)
|
||||
@@ -0,0 +1,48 @@
|
||||
--TEST--
|
||||
Test imap_reopen() using the CL_EXPUNGE flag
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(__DIR__.'/setup/skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// include file for required variables in imap_open()
|
||||
require_once(__DIR__.'/setup/imap_include.inc');
|
||||
|
||||
$mailbox_suffix = 'imapreopenwithclexpunge';
|
||||
|
||||
// set up temp mailbox with 3 messages
|
||||
$stream_id = setup_test_mailbox($mailbox_suffix , 3, $mailbox);
|
||||
|
||||
var_dump(imap_reopen($stream_id, IMAP_DEFAULT_MAILBOX . '.' . IMAP_MAILBOX_PHPT_PREFIX . $mailbox_suffix, flags: CL_EXPUNGE));
|
||||
|
||||
// mark messages in inbox for deletion
|
||||
for ($i = 1; $i < 4; $i++) {
|
||||
imap_delete($stream_id, $i);
|
||||
}
|
||||
|
||||
echo "\n-- Call to imap_close() --\n";
|
||||
var_dump( imap_close($stream_id) );
|
||||
|
||||
// check that CL_EXPUNGE in previous imap_reopen() call worked
|
||||
$stream_id = imap_open($mailbox, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD);
|
||||
echo "There are now " . imap_num_msg($stream_id) . " msgs in mailbox '$mailbox'\n";
|
||||
|
||||
// Close connection
|
||||
var_dump( imap_close($stream_id) );
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
$mailbox_suffix = 'imapreopenwithclexpunge';
|
||||
require_once(__DIR__.'/setup/clean.inc');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Create a temporary mailbox and add 3 msgs
|
||||
New mailbox created
|
||||
bool(true)
|
||||
|
||||
-- Call to imap_close() --
|
||||
bool(true)
|
||||
There are now 0 msgs in mailbox '%sINBOX.phpttestimapreopenwithclexpunge'
|
||||
bool(true)
|
||||
@@ -63,12 +63,19 @@ function displayOverviewFields($resp, array $fields = MANDATORY_OVERVIEW_FIELDS)
|
||||
* @param int message_count number of test msgs to be written to new mailbox
|
||||
* @param null $new_mailbox
|
||||
* @param bool $simpleMessages
|
||||
* @param int $flags OP_* (or CL_EXPUNGE) flags to pass to imap_open() sub-call
|
||||
* @return resource IMAP stream to new mailbox
|
||||
* @throws Exception
|
||||
*/
|
||||
function setup_test_mailbox(string $mailbox_suffix, int $message_count, &$new_mailbox = null, bool $simpleMessages = true){
|
||||
function setup_test_mailbox(
|
||||
string $mailbox_suffix,
|
||||
int $message_count,
|
||||
&$new_mailbox = null,
|
||||
bool $simpleMessages = true,
|
||||
int $flags = 0,
|
||||
){
|
||||
// open a stream to default mailbox
|
||||
$imap_stream = imap_open(IMAP_DEFAULT_MAILBOX, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD);
|
||||
$imap_stream = imap_open(IMAP_DEFAULT_MAILBOX, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD, flags: $flags);
|
||||
|
||||
if ($imap_stream === false) {
|
||||
throw new Exception("Cannot connect to IMAP server " . IMAP_SERVER . ": " . imap_last_error());
|
||||
|
||||
@@ -173,6 +173,7 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func)
|
||||
return ZEND_NAN;
|
||||
}
|
||||
|
||||
try_again:
|
||||
switch (Z_TYPE_P(z)) {
|
||||
case IS_STRING:
|
||||
type = is_numeric_string(Z_STRVAL_P(z), Z_STRLEN_P(z), &lv, &rv, 0);
|
||||
@@ -225,6 +226,9 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func)
|
||||
efree(message);
|
||||
}
|
||||
break;
|
||||
case IS_REFERENCE:
|
||||
z = Z_REFVAL_P(z);
|
||||
goto try_again;
|
||||
default:
|
||||
spprintf(&message, 0, "%s: invalid PHP type for date", func);
|
||||
intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
|
||||
@@ -8,14 +8,14 @@ class IntlDateFormatter
|
||||
* @param IntlTimeZone|DateTimeZone|string|null $timezone
|
||||
* @param IntlCalendar|int|null $calendar
|
||||
*/
|
||||
public function __construct(?string $locale, int $dateType, int $timeType, $timezone = null, $calendar = null, string $pattern = "") {}
|
||||
public function __construct(?string $locale, int $dateType, int $timeType, $timezone = null, $calendar = null, ?string $pattern = null) {}
|
||||
|
||||
/**
|
||||
* @param IntlTimeZone|DateTimeZone|string|null $timezone
|
||||
* @return IntlDateFormatter|null
|
||||
* @alias datefmt_create
|
||||
*/
|
||||
public static function create(?string $locale, int $dateType, int $timeType, $timezone = null, IntlCalendar|int|null $calendar = null, string $pattern = "") {}
|
||||
public static function create(?string $locale, int $dateType, int $timeType, $timezone = null, IntlCalendar|int|null $calendar = null, ?string $pattern = null) {}
|
||||
|
||||
/**
|
||||
* @return int|false
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 62742b5f463272f43970e98900a89d513c4fb839 */
|
||||
* Stub hash: faeef90c9c1324c6a25f0df36c7239ddc2b43ee4 */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter___construct, 0, 0, 3)
|
||||
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
|
||||
@@ -7,7 +7,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter___construct, 0, 0, 3)
|
||||
ZEND_ARG_TYPE_INFO(0, timeType, IS_LONG, 0)
|
||||
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timezone, "null")
|
||||
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, calendar, "null")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 0, "\"\"")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_create, 0, 0, 3)
|
||||
@@ -16,7 +16,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_create, 0, 0, 3)
|
||||
ZEND_ARG_TYPE_INFO(0, timeType, IS_LONG, 0)
|
||||
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timezone, "null")
|
||||
ZEND_ARG_OBJ_TYPE_MASK(0, calendar, IntlCalendar, MAY_BE_LONG|MAY_BE_NULL, "null")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 0, "\"\"")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_getDateType, 0, 0, 0)
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
|
||||
class NumberFormatter
|
||||
{
|
||||
public function __construct(string $locale, int $style, string $pattern = "") {}
|
||||
public function __construct(string $locale, int $style, ?string $pattern = null) {}
|
||||
|
||||
/**
|
||||
* @return NumberFormatter|null
|
||||
* @alias numfmt_create
|
||||
*/
|
||||
public static function create(string $locale, int $style, string $pattern = "") {}
|
||||
public static function create(string $locale, int $style, ?string $pattern = null) {}
|
||||
|
||||
/**
|
||||
* @return string|false
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 0f285bbaa6f4f37060eb8325956f41bd86e9dea3 */
|
||||
* Stub hash: de7625297bcdb8c7e4944a319c019ed68508ea2c */
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter___construct, 0, 0, 2)
|
||||
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, style, IS_LONG, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 0, "\"\"")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_class_NumberFormatter_create arginfo_class_NumberFormatter___construct
|
||||
|
||||
@@ -34,7 +34,7 @@ static int numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
||||
FORMATTER_METHOD_INIT_VARS;
|
||||
|
||||
/* Parse parameters. */
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS(), "sl|s",
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS(), "sl|s!",
|
||||
&locale, &locale_len, &style, &pattern, &pattern_len ) == FAILURE )
|
||||
{
|
||||
return FAILURE;
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
/** @generate-function-entries */
|
||||
|
||||
class IntlException extends Exception
|
||||
{
|
||||
}
|
||||
|
||||
/* calendar */
|
||||
|
||||
/** @param IntlTimeZone|DateTimeZone|string|null $timezone */
|
||||
@@ -154,7 +158,7 @@ function intl_error_name(int $errorCode): string {}
|
||||
/* dateformat */
|
||||
|
||||
/** @param IntlTimeZone|DateTimeZone|string|null $timezone */
|
||||
function datefmt_create(?string $locale, int $dateType, int $timeType, $timezone = null, IntlCalendar|int|null $calendar = null, string $pattern = ""): ?IntlDateFormatter {}
|
||||
function datefmt_create(?string $locale, int $dateType, int $timeType, $timezone = null, IntlCalendar|int|null $calendar = null, ?string $pattern = null): ?IntlDateFormatter {}
|
||||
|
||||
function datefmt_get_datetype(IntlDateFormatter $formatter): int|false {}
|
||||
|
||||
@@ -204,7 +208,7 @@ function datefmt_get_error_message(IntlDateFormatter $formatter): string {}
|
||||
|
||||
/* formatter */
|
||||
|
||||
function numfmt_create(string $locale, int $style, string $pattern = ""): ?NumberFormatter {}
|
||||
function numfmt_create(string $locale, int $style, ?string $pattern = null): ?NumberFormatter {}
|
||||
|
||||
function numfmt_format(NumberFormatter $formatter, int|float $num, int $type = NumberFormatter::TYPE_DEFAULT): string|false {}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: c890e3cde79ffeade4623001cc369aa734812959 */
|
||||
* Stub hash: 7c89762dffb3a8b4aae51ea823af2494e7dd25d5 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_create_instance, 0, 0, IntlCalendar, 1)
|
||||
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timezone, "null")
|
||||
@@ -282,7 +282,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_datefmt_create, 0, 3, IntlDateFor
|
||||
ZEND_ARG_TYPE_INFO(0, timeType, IS_LONG, 0)
|
||||
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timezone, "null")
|
||||
ZEND_ARG_OBJ_TYPE_MASK(0, calendar, IntlCalendar, MAY_BE_LONG|MAY_BE_NULL, "null")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 0, "\"\"")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_get_datetype, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
|
||||
@@ -370,7 +370,7 @@ ZEND_END_ARG_INFO()
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_numfmt_create, 0, 2, NumberFormatter, 1)
|
||||
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, style, IS_LONG, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 0, "\"\"")
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_numfmt_format, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
|
||||
@@ -1165,3 +1165,8 @@ static const zend_function_entry ext_functions[] = {
|
||||
ZEND_FE(transliterator_get_error_message, arginfo_transliterator_get_error_message)
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_IntlException_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #80763 (msgfmt_format() does not accept DateTime references)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl')) die('skip intl extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$today = new DateTime('2021-02-17 12:00:00');
|
||||
$formatter = new \MessageFormatter('en_US', 'Today is {today, date, full}.');
|
||||
$params = ['today' => $today];
|
||||
array_walk($params, fn() => 1);
|
||||
var_dump($formatter->format($params));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(38) "Today is Wednesday, February 17, 2021."
|
||||
@@ -15,3 +15,7 @@ interface JsonSerializable
|
||||
/** @return mixed */
|
||||
public function jsonSerialize();
|
||||
}
|
||||
|
||||
class JsonException extends Exception
|
||||
{
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 2d1e6c422221ec7efbbd540ee777a5ce2c639943 */
|
||||
* Stub hash: 200044f4196cd8efd1ec9a2e93d4bbb63618b3c9 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_json_encode, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
|
||||
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
|
||||
@@ -43,3 +43,8 @@ static const zend_function_entry class_JsonSerializable_methods[] = {
|
||||
ZEND_ABSTRACT_ME_WITH_FLAGS(JsonSerializable, jsonSerialize, arginfo_class_JsonSerializable_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_JsonException_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
@@ -1602,11 +1602,15 @@ cleanup_parallel:
|
||||
|
||||
if (!base_dn_str) {
|
||||
zend_argument_type_error(2, "must be of type string when argument #1 ($ldap) is a resource");
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
ldap_base_dn = zend_string_copy(base_dn_str);
|
||||
|
||||
if (!filter_str) {
|
||||
zend_argument_type_error(3, "must be of type string when argument #1 ($ldap) is a resource");
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
ldap_filter = zend_string_copy(filter_str);
|
||||
|
||||
|
||||
@@ -70,10 +70,10 @@ function ldap_first_entry($ldap, $result) {}
|
||||
|
||||
/**
|
||||
* @param resource $ldap
|
||||
* @param resource $result
|
||||
* @param resource $entry
|
||||
* @return resource|false
|
||||
*/
|
||||
function ldap_next_entry($ldap, $result) {}
|
||||
function ldap_next_entry($ldap, $entry) {}
|
||||
|
||||
/**
|
||||
* @param resource $ldap
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 9d6315aeee2e3a1be51c05b65a960ed433bbe4ec */
|
||||
* Stub hash: 9e097927708f5f1d0a2ed8267422e6095e8583b0 */
|
||||
|
||||
#if defined(HAVE_ORALDAP)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0)
|
||||
@@ -78,7 +78,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_entry, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, result)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_ldap_next_entry arginfo_ldap_first_entry
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_entry, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, ldap)
|
||||
ZEND_ARG_INFO(0, entry)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_get_entries, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
|
||||
ZEND_ARG_INFO(0, ldap)
|
||||
|
||||
@@ -39,6 +39,18 @@ try {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
|
||||
try {
|
||||
ldap_search($link, [], []);
|
||||
} catch (TypeError $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
|
||||
try {
|
||||
ldap_search($link, "", []);
|
||||
} catch (TypeError $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ldap_search(): Search: No such object in %s on line %d
|
||||
@@ -49,3 +61,5 @@ bool(false)
|
||||
ldap_search(): Argument #1 ($ldap) cannot be empty
|
||||
ldap_search(): Argument #2 ($base) must have the same number of elements as the links array
|
||||
ldap_search(): Argument #3 ($filter) must have the same number of elements as the links array
|
||||
ldap_search(): Argument #2 ($base) must be of type string when argument #1 ($ldap) is a resource
|
||||
ldap_search(): Argument #3 ($filter) must be of type string when argument #1 ($ldap) is a resource
|
||||
+49
-1
@@ -361,6 +361,54 @@ php_libxml_input_buffer_create_filename(const char *URI, xmlCharEncoding enc)
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* Check if there's been an external transport protocol with an encoding information */
|
||||
if (enc == XML_CHAR_ENCODING_NONE) {
|
||||
php_stream *s = (php_stream *) context;
|
||||
|
||||
if (Z_TYPE(s->wrapperdata) == IS_ARRAY) {
|
||||
zval *header;
|
||||
|
||||
ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL(s->wrapperdata), header) {
|
||||
const char buf[] = "Content-Type:";
|
||||
if (Z_TYPE_P(header) == IS_STRING &&
|
||||
!zend_binary_strncasecmp(Z_STRVAL_P(header), Z_STRLEN_P(header), buf, sizeof(buf)-1, sizeof(buf)-1)) {
|
||||
char *needle = estrdup("charset=");
|
||||
char *haystack = estrndup(Z_STRVAL_P(header), Z_STRLEN_P(header));
|
||||
char *encoding = php_stristr(haystack, needle, Z_STRLEN_P(header), sizeof("charset=")-1);
|
||||
|
||||
if (encoding) {
|
||||
char *end;
|
||||
|
||||
encoding += sizeof("charset=")-1;
|
||||
if (*encoding == '"') {
|
||||
encoding++;
|
||||
}
|
||||
end = strchr(encoding, ';');
|
||||
if (end == NULL) {
|
||||
end = encoding + strlen(encoding);
|
||||
}
|
||||
end--; /* end == encoding-1 isn't a buffer underrun */
|
||||
while (*end == ' ' || *end == '\t') {
|
||||
end--;
|
||||
}
|
||||
if (*end == '"') {
|
||||
end--;
|
||||
}
|
||||
if (encoding >= end) continue;
|
||||
*(end+1) = '\0';
|
||||
enc = xmlParseCharEncoding(encoding);
|
||||
if (enc <= XML_CHAR_ENCODING_NONE) {
|
||||
enc = XML_CHAR_ENCODING_NONE;
|
||||
}
|
||||
}
|
||||
efree(haystack);
|
||||
efree(needle);
|
||||
break; /* found content-type */
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate the Input buffer front-end. */
|
||||
ret = xmlAllocParserInputBuffer(enc);
|
||||
if (ret != NULL) {
|
||||
@@ -1110,7 +1158,7 @@ PHP_FUNCTION(libxml_set_external_entity_loader)
|
||||
/* {{{ Common functions shared by extensions */
|
||||
int php_libxml_xmlCheckUTF8(const unsigned char *s)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
unsigned char c;
|
||||
|
||||
for (i = 0; (c = s[i++]);) {
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
/** @generate-function-entries */
|
||||
|
||||
class LibXMLError
|
||||
{
|
||||
}
|
||||
|
||||
/** @param resource $context */
|
||||
function libxml_set_streams_context($context): void {}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: ded229511dc2bc3912d35b8055c0fd69420baff0 */
|
||||
* Stub hash: 1cc89432b61dc1997afe96e02f82a8fd1a6fcfc4 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_set_streams_context, 0, 1, IS_VOID, 0)
|
||||
ZEND_ARG_INFO(0, context)
|
||||
@@ -46,3 +46,8 @@ static const zend_function_entry ext_functions[] = {
|
||||
ZEND_FE(libxml_set_external_entity_loader, arginfo_libxml_set_external_entity_loader)
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
|
||||
static const zend_function_entry class_LibXMLError_methods[] = {
|
||||
ZEND_FE_END
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Bug #51903 (simplexml_load_file() doesn't use HTTP headers)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('simplexml')) die('skip simplexml extension not available');
|
||||
if (@!include "./ext/standard/tests/http/server.inc") die('skip server.inc not available');
|
||||
http_server_skipif();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require "./ext/standard/tests/http/server.inc";
|
||||
$responses = [
|
||||
"data://text/plain,HTTP/1.1 200 OK\r\n"
|
||||
. "Content-Type: text/xml; charset=ISO-8859-1\r\n\r\n"
|
||||
. "<?xml version=\"1.0\"?>\n"
|
||||
. "<root>\xE4\xF6\xFC</root>\n",
|
||||
"data://text/plain,HTTP/1.1 200 OK\r\n"
|
||||
. "Content-Type: text/xml; charset=ISO-8859-1; foo=bar\r\n\r\n"
|
||||
. "<?xml version=\"1.0\"?>\n"
|
||||
. "<root>\xE4\xF6\xFC</root>\n",
|
||||
"data://text/plain,HTTP/1.1 200 OK\r\n"
|
||||
. "Content-Type: text/xml; charset=\"ISO-8859-1\" ; foo=bar\r\n\r\n"
|
||||
. "<?xml version=\"1.0\"?>\n"
|
||||
. "<root>\xE4\xF6\xFC</root>\n",
|
||||
];
|
||||
['pid' => $pid, 'uri' => $uri] = http_server($responses);
|
||||
|
||||
for ($i = 0; $i < count($responses); $i++) {
|
||||
$sxe = simplexml_load_file($uri);
|
||||
echo "$sxe\n";
|
||||
}
|
||||
|
||||
http_server_kill($pid);
|
||||
?>
|
||||
--EXPECT--
|
||||
äöü
|
||||
äöü
|
||||
äöü
|
||||
+10
-10
@@ -256,11 +256,11 @@ class mysqli
|
||||
* @alias mysqli_ssl_set
|
||||
*/
|
||||
public function ssl_set(
|
||||
string $key,
|
||||
string $certificate,
|
||||
string $ca_certificate,
|
||||
string $ca_path,
|
||||
string $cipher_algos
|
||||
?string $key,
|
||||
?string $certificate,
|
||||
?string $ca_certificate,
|
||||
?string $ca_path,
|
||||
?string $cipher_algos
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -750,11 +750,11 @@ function mysqli_sqlstate(mysqli $mysql): string {}
|
||||
|
||||
function mysqli_ssl_set(
|
||||
mysqli $mysql,
|
||||
string $key,
|
||||
string $certificate,
|
||||
string $ca_certificate,
|
||||
string $ca_path,
|
||||
string $cipher_algos
|
||||
?string $key,
|
||||
?string $certificate,
|
||||
?string $ca_certificate,
|
||||
?string $ca_path,
|
||||
?string $cipher_algos
|
||||
): bool {}
|
||||
|
||||
function mysqli_stat(mysqli $mysql): string|false {}
|
||||
|
||||
@@ -2157,7 +2157,7 @@ PHP_FUNCTION(mysqli_ssl_set)
|
||||
char *ssl_parm[5];
|
||||
size_t ssl_parm_len[5], i;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osssss", &mysql_link, mysqli_link_class_entry, &ssl_parm[0], &ssl_parm_len[0], &ssl_parm[1], &ssl_parm_len[1], &ssl_parm[2], &ssl_parm_len[2], &ssl_parm[3], &ssl_parm_len[3], &ssl_parm[4], &ssl_parm_len[4]) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os!s!s!s!s!", &mysql_link, mysqli_link_class_entry, &ssl_parm[0], &ssl_parm_len[0], &ssl_parm[1], &ssl_parm_len[1], &ssl_parm[2], &ssl_parm_len[2], &ssl_parm[3], &ssl_parm_len[3], &ssl_parm[4], &ssl_parm_len[4]) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED);
|
||||
|
||||
+11
-11
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 5a8b778eaa9efcca7d3ad8bfdbaa31d9d07b25e8 */
|
||||
* Stub hash: 36c7ee22aa4c5bb5e0174031a3defcaaadde0dbd */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_affected_rows, 0, 1, MAY_BE_LONG|MAY_BE_STRING)
|
||||
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)
|
||||
@@ -386,11 +386,11 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_ssl_set, 0, 6, _IS_BOOL, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, certificate, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, ca_certificate, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, ca_path, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, cipher_algos, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 1)
|
||||
ZEND_ARG_TYPE_INFO(0, certificate, IS_STRING, 1)
|
||||
ZEND_ARG_TYPE_INFO(0, ca_certificate, IS_STRING, 1)
|
||||
ZEND_ARG_TYPE_INFO(0, ca_path, IS_STRING, 1)
|
||||
ZEND_ARG_TYPE_INFO(0, cipher_algos, IS_STRING, 1)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_stat, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
|
||||
@@ -549,11 +549,11 @@ ZEND_END_ARG_INFO()
|
||||
#define arginfo_class_mysqli_set_opt arginfo_class_mysqli_options
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_ssl_set, 0, 0, 5)
|
||||
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, certificate, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, ca_certificate, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, ca_path, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, cipher_algos, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 1)
|
||||
ZEND_ARG_TYPE_INFO(0, certificate, IS_STRING, 1)
|
||||
ZEND_ARG_TYPE_INFO(0, ca_certificate, IS_STRING, 1)
|
||||
ZEND_ARG_TYPE_INFO(0, ca_path, IS_STRING, 1)
|
||||
ZEND_ARG_TYPE_INFO(0, cipher_algos, IS_STRING, 1)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_class_mysqli_stat arginfo_class_mysqli_character_set_name
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
--TEST--
|
||||
Bug #74779 (x() and y() truncating floats to integers)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
if (!setlocale(LC_NUMERIC, "de_DE", "de_DE.UTF-8", "de-DE")) die('skip locale not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket);
|
||||
}
|
||||
|
||||
if (!setlocale(LC_NUMERIC, "de_DE", "de_DE.UTF-8", "de-DE")) {
|
||||
echo "[002] Cannot set locale\n";
|
||||
}
|
||||
|
||||
if (!$link->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, true)) {
|
||||
printf("[003] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
|
||||
if (!$result = $link->query("SELECT ST_Y(Point(56.7, 53.34))")) {
|
||||
printf("[004] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
|
||||
if (!$array = $result->fetch_array(MYSQLI_ASSOC)) {
|
||||
printf("[005] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
|
||||
var_dump($array);
|
||||
|
||||
mysqli_close($link);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
["ST_Y(Point(56.7, 53.34))"]=>
|
||||
float(53.34)
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Bug #80837 Calling stmt_store_result after fetch doesn't throw an error
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once 'skipif.inc';
|
||||
require_once 'skipifconnectfailure.inc';
|
||||
if (!defined('MYSQLI_STORE_RESULT_COPY_DATA')) die('skip requires mysqlnd');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once "connect.inc";
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||
|
||||
$mysqli->query('DROP TABLE IF EXISTS test');
|
||||
$mysqli->query('CREATE TABLE test (b int)');
|
||||
$mysqli->query('INSERT INTO test VALUES (1),(2),(3)');
|
||||
|
||||
$statement = $mysqli->prepare("SELECT b FROM test");
|
||||
$statement->execute();
|
||||
$statement->bind_result($name);
|
||||
$statement->fetch();
|
||||
try {
|
||||
$statement->store_result();
|
||||
} catch (mysqli_sql_exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
$mysqli->close();
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "clean_table.inc";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Commands out of sync; you can't run this command now
|
||||
@@ -18,8 +18,8 @@ if (!$res = $link->query("SHOW PLUGINS"))
|
||||
|
||||
$have_pam = false;
|
||||
while ($row = $res->fetch_assoc()) {
|
||||
if (isset($row['Name']) && ('mysql_clear_password' == $row['Name'])) {
|
||||
$have_pam = true;
|
||||
if (isset($row['Name']) && in_array($row['Name'], array('pam', 'authentication_pam', 'auth_pam_compat'))) {
|
||||
$have_pam = $row['Name'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -28,12 +28,54 @@ $res->close();
|
||||
if (!$have_pam)
|
||||
die("SKIP Server PAM plugin not installed");
|
||||
|
||||
if ($have_pam == 'pam') {
|
||||
/* MariaDB - needs system variable pam_use_cleartext_plugin=ON to be set */
|
||||
if (!$res = mysqli_query($link, 'SHOW GLOBAL VARIABLES LIKE "pam_use_cleartext_plugin"'))
|
||||
die(sprintf("SKIP MariaDB probe of GLOBAL VARIABLES failed [%d] %s\n",
|
||||
mysqli_errno($link), mysqli_error($link)));
|
||||
$pam_use_cleartext_plugin = mysqli_fetch_row($res);
|
||||
mysqli_free_result($res);
|
||||
if (!$pam_use_cleartext_plugin or $pam_use_cleartext_plugin[1]!='ON')
|
||||
die("SKIP Server setting pam_use_cleartext_plugin!=ON");
|
||||
|
||||
$pam_service = file_get_contents('/etc/pam.d/mysql');
|
||||
} elseif ($have_pam == 'authentication_pam') {
|
||||
/*
|
||||
required MySQL syntax:
|
||||
https://dev.mysql.com/doc/refman/8.0/en/pam-pluggable-authentication.html#pam-pluggable-authentication-usage
|
||||
*/
|
||||
$have_pam .= " AS 'mysql-unix'";
|
||||
$pam_service = file_get_contents('/etc/pam.d/mysql-unix');
|
||||
} else {
|
||||
$pam_service = file_get_contents('/etc/pam.d/mysql');
|
||||
}
|
||||
$auth = 0;
|
||||
$account = 0;
|
||||
foreach (explode("\n", $pam_service) as $line)
|
||||
{
|
||||
if (preg_match('/^auth/', $line)) {
|
||||
$auth = 1;
|
||||
} elseif (preg_match('/^account/', $line)) {
|
||||
$account = 1;
|
||||
}
|
||||
}
|
||||
if (!$auth) {
|
||||
die("SKIP pam service file missing 'auth' directive");
|
||||
}
|
||||
if (!$account) {
|
||||
die("SKIP pam service file missing 'account' directive");
|
||||
}
|
||||
|
||||
if (!posix_getpwnam('pamtest')) {
|
||||
die("SKIP no pamtest user");
|
||||
}
|
||||
/* Password of user 'pamtest' should be set to 'pamtest' */
|
||||
|
||||
mysqli_query($link, 'DROP USER pamtest');
|
||||
mysqli_query($link, 'DROP USER pamtest@localhost');
|
||||
|
||||
if (!mysqli_query($link, 'CREATE USER pamtest@"%" IDENTIFIED WITH mysql_clear_password') ||
|
||||
!mysqli_query($link, 'CREATE USER pamtest@"localhost" IDENTIFIED WITH mysql_clear_password')) {
|
||||
if (!mysqli_query($link, "CREATE USER pamtest@'%' IDENTIFIED WITH $have_pam") ||
|
||||
!mysqli_query($link, "CREATE USER pamtest@'localhost' IDENTIFIED WITH $have_pam")) {
|
||||
printf("skip Cannot create second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
|
||||
mysqli_close($link);
|
||||
die("skip CREATE USER failed");
|
||||
@@ -59,8 +101,8 @@ max_execution_time=240
|
||||
require_once('table.inc');
|
||||
|
||||
if (!$link = my_mysqli_connect($host, 'pamtest', 'pamtest', $db, $port, $socket)) {
|
||||
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket);
|
||||
printf("[001] Cannot connect to the server using host=%s, user=pamtest, passwd=pamtest dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $db, $port, $socket);
|
||||
} else {
|
||||
|
||||
if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
|
||||
@@ -87,6 +129,4 @@ max_execution_time=240
|
||||
mysqli_query($link, 'DROP USER pamtest@localhost');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: mysqli_real_connect(): (28000/1045): Access denied for user %s
|
||||
[001] Cannot connect to the server using host=%s
|
||||
done!
|
||||
Loaded 100 of 234 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user