mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-26 02:15:42 +00:00
Compare commits
213
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c6de12b2d | ||
|
|
b215d1339f | ||
|
|
f3ff72e54b | ||
|
|
a0749fe483 | ||
|
|
199eb2b110 | ||
|
|
53b0f4ba4e | ||
|
|
65ada39360 | ||
|
|
15e01132cf | ||
|
|
10b208f28d | ||
|
|
9569a0b8ca | ||
|
|
d7c7522be9 | ||
|
|
972223c342 | ||
|
|
83cdb89f8a | ||
|
|
a5f98139c9 | ||
|
|
7d1aa7534d | ||
|
|
5f2f6180b9 | ||
|
|
2df32942d3 | ||
|
|
22a3fa0b2e | ||
|
|
249c20023d | ||
|
|
f4474e5724 | ||
|
|
d154301866 | ||
|
|
a3e6b50442 | ||
|
|
a4633b13d4 | ||
|
|
2d3bc71e89 | ||
|
|
9a495911c8 | ||
|
|
37bba7a678 | ||
|
|
ac60007bec | ||
|
|
8f69ca8dcd | ||
|
|
2e02579474 | ||
|
|
793fd6bce9 | ||
|
|
547665c720 | ||
|
|
59b0b38d3c | ||
|
|
2205546edf | ||
|
|
ee153deb1f | ||
|
|
b01d9fdab1 | ||
|
|
06eef1f70f | ||
|
|
d293f6dcff | ||
|
|
370997fb5d | ||
|
|
8b53c7232e | ||
|
|
dc586bff36 | ||
|
|
61a38bb274 | ||
|
|
de7d0256a3 | ||
|
|
5d67271db0 | ||
|
|
f3cd6931ca | ||
|
|
582469eef2 | ||
|
|
3051147019 | ||
|
|
6c73b2088a | ||
|
|
7821cc3b9f | ||
|
|
72c330f1e6 | ||
|
|
817b50826e | ||
|
|
59dfaa3f99 | ||
|
|
dee977b7a7 | ||
|
|
d661a75d54 | ||
|
|
5533f2490a | ||
|
|
9d473f1eac | ||
|
|
fbb6a27212 | ||
|
|
c34895e837 | ||
|
|
13dffa9d32 | ||
|
|
dc1d99e772 | ||
|
|
73ff4193be | ||
|
|
e63b2ba310 | ||
|
|
9bca9ef6cf | ||
|
|
c7eb0feed8 | ||
|
|
e77c8e45ba | ||
|
|
16e037bd46 | ||
|
|
7cf7148a8f | ||
|
|
ed6dee9a19 | ||
|
|
0cb43ec51c | ||
|
|
a0c9d0849a | ||
|
|
31ce1cbbb9 | ||
|
|
209b12e064 | ||
|
|
8baf3ffde6 | ||
|
|
6f9dfd9473 | ||
|
|
b394654c1e | ||
|
|
9a74b23297 | ||
|
|
d4867e099e | ||
|
|
fa6a4483e6 | ||
|
|
aa9c76d027 | ||
|
|
f308aa4e1e | ||
|
|
96404eb8e2 | ||
|
|
69c634a56d | ||
|
|
62fe6ba20c | ||
|
|
3a719696bc | ||
|
|
3a0de243c3 | ||
|
|
2d29263a9f | ||
|
|
7b42cdf95e | ||
|
|
97ba6b0d8b | ||
|
|
30f1b17262 | ||
|
|
fc4836b193 | ||
|
|
cd188d0398 | ||
|
|
bdce5849b7 | ||
|
|
367788cbc3 | ||
|
|
d23bc33dc1 | ||
|
|
e6a191de1b | ||
|
|
4ebd9a5366 | ||
|
|
5f8c22d415 | ||
|
|
11740abd6b | ||
|
|
202e6936d6 | ||
|
|
354a76bb80 | ||
|
|
a8a019d68a | ||
|
|
db8ef71353 | ||
|
|
64ec9f4dbe | ||
|
|
fd607635a4 | ||
|
|
e246dea9fe | ||
|
|
9d76fbd0c4 | ||
|
|
5846119e50 | ||
|
|
35353dc49a | ||
|
|
714d2d8ae1 | ||
|
|
8511c204c3 | ||
|
|
4fa32d67bf | ||
|
|
bb7ecb8704 | ||
|
|
a43678aa12 | ||
|
|
5c4d125d4c | ||
|
|
2d93cce03a | ||
|
|
1a98878bfe | ||
|
|
704a0ab0c9 | ||
|
|
aa74c30466 | ||
|
|
ad63bd169b | ||
|
|
69bab6e5a5 | ||
|
|
bec68d59a2 | ||
|
|
b6b15fc65c | ||
|
|
43e6fd1e2b | ||
|
|
f95b27c6f6 | ||
|
|
0cad701374 | ||
|
|
cc5c51e7f0 | ||
|
|
bec22af8d7 | ||
|
|
b15bfb9129 | ||
|
|
49b5ffe48c | ||
|
|
3759c6316d | ||
|
|
d2037b1bd4 | ||
|
|
af4143753f | ||
|
|
fd1ffa4692 | ||
|
|
27f168cf63 | ||
|
|
90318fbcbe | ||
|
|
35c80583f0 | ||
|
|
e46b3c3e70 | ||
|
|
e359812ce3 | ||
|
|
236522529c | ||
|
|
3d0a0f801b | ||
|
|
e2ef4e9e2f | ||
|
|
d19b6aa5ba | ||
|
|
d153fbc5a9 | ||
|
|
36a7d9fca4 | ||
|
|
9977de0028 | ||
|
|
78d24429f2 | ||
|
|
6b73e692c9 | ||
|
|
d91b643c87 | ||
|
|
1210c3b960 | ||
|
|
66b32f25d5 | ||
|
|
cb5af4e8a0 | ||
|
|
f80ad18afa | ||
|
|
506a764089 | ||
|
|
2c3933821f | ||
|
|
6c631ccfef | ||
|
|
a30b919872 | ||
|
|
18a9ae412f | ||
|
|
44494c09bc | ||
|
|
3891e0d13a | ||
|
|
3fc1bdc81c | ||
|
|
cd94cf60a2 | ||
|
|
ff2b5bda59 | ||
|
|
5da0579259 | ||
|
|
7faaf5a89a | ||
|
|
9bf11045db | ||
|
|
06b130579e | ||
|
|
fc9cdb723b | ||
|
|
f83c207d60 | ||
|
|
1bdd97a601 | ||
|
|
6d8892aacd | ||
|
|
91c6fb881e | ||
|
|
3309f2fbb9 | ||
|
|
57d5dc5688 | ||
|
|
e561d4100b | ||
|
|
16609880f8 | ||
|
|
70239ea1d3 | ||
|
|
7ddfe73e69 | ||
|
|
3e31ae5d70 | ||
|
|
bfbfb9dabd | ||
|
|
dcba479848 | ||
|
|
37ca6a7a2a | ||
|
|
ad0acc0aa9 | ||
|
|
fe202d99c8 | ||
|
|
191e15309f | ||
|
|
5d21a15cc3 | ||
|
|
68892410f7 | ||
|
|
4831e150c5 | ||
|
|
cedee4408b | ||
|
|
fb4c811835 | ||
|
|
ce73841cdc | ||
|
|
ccf051c317 | ||
|
|
0b8414832e | ||
|
|
2549f7d220 | ||
|
|
295c66911f | ||
|
|
4450288344 | ||
|
|
d1bce98597 | ||
|
|
06fa35568e | ||
|
|
fd4c42efab | ||
|
|
a7ada30ac6 | ||
|
|
3a04adce82 | ||
|
|
b2f49c69b1 | ||
|
|
e9aa0337ab | ||
|
|
bfadd9fdaf | ||
|
|
ac12cc85aa | ||
|
|
f0ccd9ffc6 | ||
|
|
d20053a556 | ||
|
|
6088713216 | ||
|
|
7b1a4e2400 | ||
|
|
ec8457d982 | ||
|
|
6fe75f9e45 | ||
|
|
e90bce7f08 | ||
|
|
6c44a71e4a | ||
|
|
f9a755d0d2 | ||
|
|
5ae49c43dc |
No files matched your search
+1
-1
@@ -16,7 +16,7 @@ environment:
|
||||
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
|
||||
PHP_BUILD_OBJ_DIR: c:\obj
|
||||
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
|
||||
PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0beta4
|
||||
PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0beta6
|
||||
PHP_BUILD_CRT: vc15
|
||||
# ext and env setup for tests
|
||||
#MYSQL_TEST_PASSWD: Password12!
|
||||
|
||||
+10
-23
@@ -3,45 +3,32 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
tab_width = 4
|
||||
|
||||
[*.{c,h,y,awk,w32,bat,mk,frag,cpp}]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
[{*.{awk,bat,c,cpp,d,h,l,mk,re,skl,w32,y},Makefile*}]
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{php,phpt,inc}]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
[*.{dtd,html,inc,php,phpt,rng,wsdl,xml,xsd,xsl}]
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{yml,m4,sh}]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
[*.{ac,m4,sh,yml}]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 80
|
||||
|
||||
[COMMIT_EDITMSG]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 80
|
||||
|
||||
[*.patch]
|
||||
trim_trailing_whitespace = false
|
||||
+2
-1
@@ -67,7 +67,8 @@ before_script:
|
||||
|
||||
# Run PHPs run-tests.php
|
||||
script:
|
||||
- ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php $(if [ $ENABLE_DEBUG == 0 ]; then echo "-d opcache.enable_cli=1 -d zend_extension=`pwd`/modules/opcache.so"; fi) -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --offline --show-diff --show-slow 1000 --set-timeout 120
|
||||
- ./sapi/cli/php run-tests.php -P -d extension=`pwd`/modules/zend_test.so $(if [ $ENABLE_DEBUG == 0 ]; then echo "-d opcache.enable_cli=1 -d zend_extension=`pwd`/modules/opcache.so"; fi) -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --offline --show-diff --show-slow 1000 --set-timeout 120
|
||||
- sapi/cli/php -d extension_dir=`pwd`/modules -r 'dl("zend_test");'
|
||||
|
||||
after_success:
|
||||
- ccache --show-stats
|
||||
@@ -1,6 +1,107 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? ????, PHP 7.3.5
|
||||
13 Jun 2019, PHP 7.3.7RC1
|
||||
|
||||
- Core:
|
||||
. Fixed bug #76980 (Interface gets skipped if autoloader throws an exception).
|
||||
(Nikita)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug #78025 (segfault when accessing properties of DOMDocumentType).
|
||||
(cmb)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #77956 (When mysqli.allow_local_infile = Off, use a meaningful
|
||||
error message). (Sjon Hortensius)
|
||||
. Fixed bug #38546 (bindParam incorrect processing of bool types).
|
||||
(camporter)
|
||||
|
||||
- MySQLnd:
|
||||
. Fixed bug #77955 (Random segmentation fault in mysqlnd from php-fpm).
|
||||
(Nikita)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #78015 (Incorrect evaluation of expressions involving partials
|
||||
arrays in SCCP). (Nikita)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #78079 (openssl_encrypt_ccm.phpt fails with OpenSSL 1.1.1c).
|
||||
(Jakub Zelenka)
|
||||
|
||||
- phpdbg:
|
||||
. Fixed bug #78050 (SegFault phpdbg + opcache on include file twice).
|
||||
(Nikita)
|
||||
|
||||
- Sockets:
|
||||
. Fixed bug #78038 (Socket_select fails when resource array contains
|
||||
references). (Nikita)
|
||||
|
||||
- Sodium:
|
||||
. Fixed bug #78114 (segfault when calling sodium_* functions from eval). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #77135 (Extract with EXTR_SKIP should skip $this).
|
||||
(Craig Duncan, Dmitry)
|
||||
. Fixed bug ##77937 (preg_match failed). (cmb, Anatol)
|
||||
|
||||
- Zip:
|
||||
. Fixed bug #76345 (zip.h not found). (Michael Maroszek)
|
||||
|
||||
30 May 2019, PHP 7.3.6
|
||||
|
||||
- cURL:
|
||||
. Implemented FR #72189 (Add missing CURL_VERSION_* constants). (Javier
|
||||
Spagnoletti)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #77988 (heap-buffer-overflow on php_jpg_get16).
|
||||
(CVE-2019-11040) (Stas)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #77934 (php-fpm kill -USR2 not working). (Jakub Zelenka)
|
||||
. Fixed bug #77921 (static.php.net doesn't work anymore). (Peter Kokot)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #77943 (imageantialias($image, false); does not work). (cmb)
|
||||
. Fixed bug #77973 (Uninitialized read in gdImageCreateFromXbm).
|
||||
(CVE-2019-11038) (cmb)
|
||||
|
||||
- Iconv:
|
||||
. Fixed bug #78069 (Out-of-bounds read in iconv.c:_php_iconv_mime_decode()
|
||||
due to integer overflow). (CVE-2019-11039). (maris dot adam)
|
||||
|
||||
- JSON:
|
||||
. Fixed bug #77843 (Use after free with json serializer). (Nikita)
|
||||
|
||||
- Opcache:
|
||||
. Fixed possible crashes, because of inconsistent PCRE cache and opcache
|
||||
SHM reset. (Alexey Kalinin, Dmitry)
|
||||
|
||||
- PDO_MySQL:
|
||||
. Fixed bug #77944 (Wrong meta pdo_type for bigint on LLP64). (cmb)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug #75186 (Inconsistent reflection of Closure:::__invoke()). (Nikita)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #77911 (Wrong warning for session.sid_bits_per_character). (cmb)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #77945 (Segmentation fault when constructing SoapClient with
|
||||
WSDL_CACHE_BOTH). (Nikita)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #77024 (SplFileObject::__toString() may return array). (Craig
|
||||
Duncan)
|
||||
|
||||
- SQLite:
|
||||
. Fixed bug #77967 (Bypassing open_basedir restrictions via file uris). (Stas)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #77931 (Warning for array_map mentions wrong type). (Nikita)
|
||||
. Fixed bug #78003 (strip_tags output change since PHP 7.3). (cmb)
|
||||
|
||||
02 May 2019, PHP 7.3.5
|
||||
|
||||
- Core:
|
||||
. Fixed bug #77903 (ArrayIterator stops iterating after offsetSet call).
|
||||
@@ -10,6 +111,10 @@ PHP NEWS
|
||||
. Fixed bug #77794 (Incorrect Date header format in built-in server).
|
||||
(kelunik)
|
||||
|
||||
- EXIF
|
||||
. Fixed bug #77950 (Heap-buffer-overflow in _estrndup via exif_process_IFD_TAG).
|
||||
(CVE-2019-11036) (Stas)
|
||||
|
||||
- Interbase:
|
||||
. Fixed bug #72175 (Impossibility of creating multiple connections to
|
||||
Interbase with php 7.x). (Nikita)
|
||||
@@ -21,6 +126,9 @@ PHP NEWS
|
||||
- LDAP:
|
||||
. Fixed bug #77869 (Core dump when using server controls) (mcmic)
|
||||
|
||||
- Mail
|
||||
. Fixed bug #77821 (Potential heap corruption in TSendMail()). (cmb)
|
||||
|
||||
- mbstring:
|
||||
. Implemented FR #72777 (Implement regex stack limits for mbregex functions).
|
||||
(Yasuo Ohgaki, Stas)
|
||||
@@ -82,8 +190,10 @@ PHP NEWS
|
||||
. Fixed bug #77578 (Crash when php unload). (cmb)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #77753 (Heap-buffer-overflow in php_ifd_get32s). (Stas)
|
||||
. Fixed bug #77831 (Heap-buffer-overflow in exif_iif_add_value). (Stas)
|
||||
. Fixed bug #77753 (Heap-buffer-overflow in php_ifd_get32s). (CVE-2019-11034)
|
||||
(Stas)
|
||||
. Fixed bug #77831 (Heap-buffer-overflow in exif_iif_add_value).
|
||||
(CVE-2019-11035) (Stas)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #77677 (FPM fails to build on AIX due to missing WCOREDUMP).
|
||||
|
||||
@@ -167,13 +167,7 @@ TSRM_API const char *tsrm_api_name(void);
|
||||
#define TSRMG_BULK_STATIC(id, type) ((type) (*((void ***) TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(id)])
|
||||
#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE;
|
||||
#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE = NULL;
|
||||
#if ZEND_DEBUG
|
||||
#define TSRMLS_CACHE_UPDATE() TSRMLS_CACHE = tsrm_get_ls_cache()
|
||||
#define TSRMLS_CACHE_RESET()
|
||||
#else
|
||||
#define TSRMLS_CACHE_UPDATE() if (!TSRMLS_CACHE) TSRMLS_CACHE = tsrm_get_ls_cache()
|
||||
#define TSRMLS_CACHE_RESET() TSRMLS_CACHE = NULL
|
||||
#endif
|
||||
#define TSRMLS_CACHE _tsrm_ls_cache
|
||||
|
||||
/* BC only */
|
||||
|
||||
@@ -622,9 +622,11 @@ Curl:
|
||||
. CURL_SSLVERSION_MAX_TLSv1_2
|
||||
. CURL_SSLVERSION_MAX_TLSv1_3
|
||||
. CURL_SSLVERSION_TLSv1_3
|
||||
. CURL_VERSION_ALTSVC
|
||||
. CURL_VERSION_ASYNCHDNS
|
||||
. CURL_VERSION_BROTLI
|
||||
. CURL_VERSION_CONV
|
||||
. CURL_VERSION_CURLDEBUG
|
||||
. CURL_VERSION_DEBUG
|
||||
. CURL_VERSION_GSSAPI
|
||||
. CURL_VERSION_GSSNEGOTIATE
|
||||
@@ -634,6 +636,7 @@ Curl:
|
||||
. CURL_VERSION_MULTI_SSL
|
||||
. CURL_VERSION_NTLM
|
||||
. CURL_VERSION_NTLM_WB
|
||||
. CURL_VERSION_PSL
|
||||
. CURL_VERSION_SPNEGO
|
||||
. CURL_VERSION_SSPI
|
||||
. CURL_VERSION_TLSAUTH_SRP
|
||||
@@ -728,8 +731,8 @@ LDAP:
|
||||
is used only when error_log is set syslog.
|
||||
|
||||
- mbstring.regex_stack_limit
|
||||
. New INI directive (since 7.3.6) limiting stack depth of mbstring/oniguruma
|
||||
regular expressions.
|
||||
. New INI directive (since 7.3.5) limiting stack depth of mbstring/oniguruma
|
||||
regular expressions.
|
||||
|
||||
========================================
|
||||
12. Windows Support
|
||||
@@ -748,4 +751,3 @@ LDAP:
|
||||
|
||||
. The cyclic GC has been enhanced, which may result in considerable performance
|
||||
improvements.
|
||||
|
||||
@@ -13,18 +13,22 @@ spl_autoload_register(function ($className) {
|
||||
}
|
||||
});
|
||||
|
||||
new Foo;
|
||||
try {
|
||||
new Foo();
|
||||
} catch (Exception $e) { }
|
||||
|
||||
// We never reach here.
|
||||
var_dump(new Foo());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(3) "Foo"
|
||||
string(3) "Bar"
|
||||
|
||||
Fatal error: Uncaught Exception: Bar in %s:%d
|
||||
Fatal error: During class fetch: Uncaught Exception: Bar in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: {closure}('Bar')
|
||||
#1 %s(%d): spl_autoload_call('Bar')
|
||||
#2 [internal function]: {closure}('Foo')
|
||||
#3 %s(%d): spl_autoload_call('Foo')
|
||||
#4 {main}
|
||||
thrown in %s on line %d
|
||||
#4 {main} in %s on line %d
|
||||
@@ -46,7 +46,7 @@ elseif (PHP_OS == 'FreeBSD') {
|
||||
die('skip Not enough memory.');
|
||||
}
|
||||
} elseif (PHP_OS == "WINNT") {
|
||||
$s = trim(shell_exec("wmic OS get FreeVirtualMemory /Value 2>nil"));
|
||||
$s = trim(shell_exec("wmic OS get FreeVirtualMemory /Value 2>nul"));
|
||||
$freeMemory = explode('=', $s)[1]*1;
|
||||
|
||||
if ($freeMemory < 2.1*1024*1024) {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
--TEST--
|
||||
Bug #77993 (Wrong parse error for invalid hex literal on Windows)
|
||||
--FILE--
|
||||
<?php
|
||||
0xg10;
|
||||
--EXPECTF--
|
||||
Parse error: syntax error, unexpected 'xg10' (T_STRING) in %s on line %d
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
The parent class is not necessarily the class of the prototype
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
function test(): B {}
|
||||
}
|
||||
class B extends A {}
|
||||
class C extends B {
|
||||
function test(): parent {}
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "3.3.5-dev"
|
||||
#define ZEND_VERSION "3.3.7RC1"
|
||||
|
||||
#define ZEND_ENGINE_3
|
||||
|
||||
|
||||
+23
-13
@@ -2051,13 +2051,13 @@ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module) /
|
||||
}
|
||||
|
||||
name_len = strlen(module->name);
|
||||
lcname = zend_string_alloc(name_len, 1);
|
||||
lcname = zend_string_alloc(name_len, module->type == MODULE_PERSISTENT);
|
||||
zend_str_tolower_copy(ZSTR_VAL(lcname), module->name, name_len);
|
||||
|
||||
lcname = zend_new_interned_string(lcname);
|
||||
if ((module_ptr = zend_hash_add_mem(&module_registry, lcname, module, sizeof(zend_module_entry))) == NULL) {
|
||||
zend_error(E_CORE_WARNING, "Module '%s' already loaded", module->name);
|
||||
zend_string_release_ex(lcname, 1);
|
||||
zend_string_release(lcname);
|
||||
return NULL;
|
||||
}
|
||||
module = module_ptr;
|
||||
@@ -2065,14 +2065,14 @@ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module) /
|
||||
|
||||
if (module->functions && zend_register_functions(NULL, module->functions, NULL, module->type)==FAILURE) {
|
||||
zend_hash_del(&module_registry, lcname);
|
||||
zend_string_release_ex(lcname, 1);
|
||||
zend_string_release(lcname);
|
||||
EG(current_module) = NULL;
|
||||
zend_error(E_CORE_WARNING,"%s: Unable to register functions, unable to load", module->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EG(current_module) = NULL;
|
||||
zend_string_release_ex(lcname, 1);
|
||||
zend_string_release(lcname);
|
||||
return module;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2279,14 +2279,14 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
lowercase_name = zend_string_tolower_ex(internal_function->function_name, 1);
|
||||
lowercase_name = zend_string_tolower_ex(internal_function->function_name, type == MODULE_PERSISTENT);
|
||||
lowercase_name = zend_new_interned_string(lowercase_name);
|
||||
reg_function = malloc(sizeof(zend_internal_function));
|
||||
memcpy(reg_function, &function, sizeof(zend_internal_function));
|
||||
if (zend_hash_add_ptr(target_function_table, lowercase_name, reg_function) == NULL) {
|
||||
unload=1;
|
||||
free(reg_function);
|
||||
zend_string_release_ex(lowercase_name, 1);
|
||||
zend_string_release(lowercase_name);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2378,7 +2378,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
|
||||
}
|
||||
ptr++;
|
||||
count++;
|
||||
zend_string_release_ex(lowercase_name, 1);
|
||||
zend_string_release(lowercase_name);
|
||||
}
|
||||
if (unload) { /* before unloading, display all remaining bad function in the module */
|
||||
if (scope) {
|
||||
@@ -2724,10 +2724,10 @@ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class
|
||||
class_entry->info.internal.module = EG(current_module);
|
||||
|
||||
if (class_entry->info.internal.builtin_functions) {
|
||||
zend_register_functions(class_entry, class_entry->info.internal.builtin_functions, &class_entry->function_table, MODULE_PERSISTENT);
|
||||
zend_register_functions(class_entry, class_entry->info.internal.builtin_functions, &class_entry->function_table, EG(current_module)->type);
|
||||
}
|
||||
|
||||
lowercase_name = zend_string_tolower_ex(orig_class_entry->name, 1);
|
||||
lowercase_name = zend_string_tolower_ex(orig_class_entry->name, EG(current_module)->type == MODULE_PERSISTENT);
|
||||
lowercase_name = zend_new_interned_string(lowercase_name);
|
||||
zend_hash_update_ptr(CG(class_table), lowercase_name, class_entry);
|
||||
zend_string_release_ex(lowercase_name, 1);
|
||||
@@ -2786,6 +2786,11 @@ ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zen
|
||||
{
|
||||
zend_string *lcname;
|
||||
|
||||
/* TODO: Move this out of here in 7.4. */
|
||||
if (persistent && EG(current_module) && EG(current_module)->type == MODULE_TEMPORARY) {
|
||||
persistent = 0;
|
||||
}
|
||||
|
||||
if (name[0] == '\\') {
|
||||
lcname = zend_string_alloc(name_len-1, persistent);
|
||||
zend_str_tolower_copy(ZSTR_VAL(lcname), name+1, name_len-1);
|
||||
@@ -2843,7 +2848,7 @@ ZEND_API int zend_disable_function(char *function_name, size_t function_name_len
|
||||
{
|
||||
zend_internal_function *func;
|
||||
if ((func = zend_hash_str_find_ptr(CG(function_table), function_name, function_name_length))) {
|
||||
func->fn_flags &= ~(ZEND_ACC_VARIADIC | ZEND_ACC_HAS_TYPE_HINTS);
|
||||
func->fn_flags &= ~(ZEND_ACC_VARIADIC | ZEND_ACC_HAS_TYPE_HINTS | ZEND_ACC_HAS_RETURN_TYPE);
|
||||
func->num_args = 0;
|
||||
func->arg_info = NULL;
|
||||
func->handler = ZEND_FN(display_disabled_function);
|
||||
@@ -3696,6 +3701,11 @@ static inline zend_string *zval_make_interned_string(zval *zv) /* {{{ */
|
||||
return Z_STR_P(zv);
|
||||
}
|
||||
|
||||
static zend_always_inline zend_bool is_persistent_class(zend_class_entry *ce) {
|
||||
return (ce->type & ZEND_INTERNAL_CLASS)
|
||||
&& ce->info.internal.module->type == MODULE_PERSISTENT;
|
||||
}
|
||||
|
||||
ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment) /* {{{ */
|
||||
{
|
||||
zend_property_info *property_info, *property_info_ptr;
|
||||
@@ -3761,10 +3771,10 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, z
|
||||
if (access_type & ZEND_ACC_PUBLIC) {
|
||||
property_info->name = zend_string_copy(name);
|
||||
} else if (access_type & ZEND_ACC_PRIVATE) {
|
||||
property_info->name = zend_mangle_property_name(ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), ZSTR_VAL(name), ZSTR_LEN(name), ce->type & ZEND_INTERNAL_CLASS);
|
||||
property_info->name = zend_mangle_property_name(ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), ZSTR_VAL(name), ZSTR_LEN(name), is_persistent_class(ce));
|
||||
} else {
|
||||
ZEND_ASSERT(access_type & ZEND_ACC_PROTECTED);
|
||||
property_info->name = zend_mangle_property_name("*", 1, ZSTR_VAL(name), ZSTR_LEN(name), ce->type & ZEND_INTERNAL_CLASS);
|
||||
property_info->name = zend_mangle_property_name("*", 1, ZSTR_VAL(name), ZSTR_LEN(name), is_persistent_class(ce));
|
||||
}
|
||||
|
||||
property_info->name = zend_new_interned_string(property_info->name);
|
||||
@@ -3779,7 +3789,7 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, z
|
||||
|
||||
ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, size_t name_length, zval *property, int access_type) /* {{{ */
|
||||
{
|
||||
zend_string *key = zend_string_init(name, name_length, ce->type & ZEND_INTERNAL_CLASS);
|
||||
zend_string *key = zend_string_init(name, name_length, is_persistent_class(ce));
|
||||
int ret = zend_declare_property_ex(ce, key, property, access_type, NULL);
|
||||
zend_string_release(key);
|
||||
return ret;
|
||||
|
||||
@@ -110,6 +110,17 @@ static zend_always_inline void zend_arena_release(zend_arena **arena_ptr, void *
|
||||
arena->ptr = (char*)checkpoint;
|
||||
}
|
||||
|
||||
static zend_always_inline zend_bool zend_arena_contains(zend_arena *arena, void *ptr)
|
||||
{
|
||||
while (arena) {
|
||||
if ((char*)ptr > (char*)arena && (char*)ptr <= arena->ptr) {
|
||||
return 1;
|
||||
}
|
||||
arena = arena->prev;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* _ZEND_ARENA_H_ */
|
||||
|
||||
/*
|
||||
|
||||
+21
-7
@@ -1359,14 +1359,28 @@ zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zval *
|
||||
if (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) {
|
||||
return zend_lookup_class_ex(class_name, key, 0);
|
||||
} else if ((ce = zend_lookup_class_ex(class_name, key, 1)) == NULL) {
|
||||
if ((fetch_type & ZEND_FETCH_CLASS_SILENT) == 0 && !EG(exception)) {
|
||||
if ((fetch_type & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_INTERFACE) {
|
||||
zend_throw_or_error(fetch_type, NULL, "Interface '%s' not found", ZSTR_VAL(class_name));
|
||||
} else if ((fetch_type & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_TRAIT) {
|
||||
zend_throw_or_error(fetch_type, NULL, "Trait '%s' not found", ZSTR_VAL(class_name));
|
||||
} else {
|
||||
zend_throw_or_error(fetch_type, NULL, "Class '%s' not found", ZSTR_VAL(class_name));
|
||||
if (fetch_type & ZEND_FETCH_CLASS_SILENT) {
|
||||
return NULL;
|
||||
}
|
||||
if (EG(exception)) {
|
||||
if (!(fetch_type & ZEND_FETCH_CLASS_EXCEPTION)) {
|
||||
zend_string *exception_str;
|
||||
zval exception_zv;
|
||||
ZVAL_OBJ(&exception_zv, EG(exception));
|
||||
Z_ADDREF(exception_zv);
|
||||
zend_clear_exception();
|
||||
exception_str = zval_get_string(&exception_zv);
|
||||
zend_error_noreturn(E_ERROR,
|
||||
"During class fetch: Uncaught %s", ZSTR_VAL(exception_str));
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
if ((fetch_type & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_INTERFACE) {
|
||||
zend_throw_or_error(fetch_type, NULL, "Interface '%s' not found", ZSTR_VAL(class_name));
|
||||
} else if ((fetch_type & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_TRAIT) {
|
||||
zend_throw_or_error(fetch_type, NULL, "Trait '%s' not found", ZSTR_VAL(class_name));
|
||||
} else {
|
||||
zend_throw_or_error(fetch_type, NULL, "Class '%s' not found", ZSTR_VAL(class_name));
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+6
-4
@@ -481,6 +481,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_iterator_del(uint32_t idx)
|
||||
|
||||
if (EXPECTED(iter->ht) && EXPECTED(iter->ht != HT_POISONED_PTR)
|
||||
&& EXPECTED(!HT_ITERATORS_OVERFLOW(iter->ht))) {
|
||||
ZEND_ASSERT(HT_ITERATORS_COUNT(iter->ht) != 0);
|
||||
HT_DEC_ITERATORS_COUNT(iter->ht);
|
||||
}
|
||||
iter->ht = NULL;
|
||||
@@ -1928,7 +1929,8 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
|
||||
target->pDestructor = ZVAL_PTR_DTOR;
|
||||
|
||||
if (source->nNumOfElements == 0) {
|
||||
HT_FLAGS(target) = (HT_FLAGS(source) & ~(HASH_FLAG_INITIALIZED|HASH_FLAG_PACKED)) | HASH_FLAG_STATIC_KEYS;
|
||||
uint32_t mask = HASH_FLAG_MASK & ~(HASH_FLAG_INITIALIZED|HASH_FLAG_PACKED);
|
||||
HT_FLAGS(target) = (HT_FLAGS(source) & mask) | HASH_FLAG_STATIC_KEYS;
|
||||
target->nTableMask = HT_MIN_MASK;
|
||||
target->nNumUsed = 0;
|
||||
target->nNumOfElements = 0;
|
||||
@@ -1936,7 +1938,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
|
||||
target->nInternalPointer = 0;
|
||||
HT_SET_DATA_ADDR(target, &uninitialized_bucket);
|
||||
} else if (GC_FLAGS(source) & IS_ARRAY_IMMUTABLE) {
|
||||
HT_FLAGS(target) = HT_FLAGS(source);
|
||||
HT_FLAGS(target) = HT_FLAGS(source) & HASH_FLAG_MASK;
|
||||
target->nTableMask = source->nTableMask;
|
||||
target->nNumUsed = source->nNumUsed;
|
||||
target->nNumOfElements = source->nNumOfElements;
|
||||
@@ -1945,7 +1947,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
|
||||
target->nInternalPointer = source->nInternalPointer;
|
||||
memcpy(HT_GET_DATA_ADDR(target), HT_GET_DATA_ADDR(source), HT_USED_SIZE(source));
|
||||
} else if (HT_FLAGS(source) & HASH_FLAG_PACKED) {
|
||||
HT_FLAGS(target) = HT_FLAGS(source);
|
||||
HT_FLAGS(target) = HT_FLAGS(source) & HASH_FLAG_MASK;
|
||||
target->nTableMask = HT_MIN_MASK;
|
||||
target->nNumUsed = source->nNumUsed;
|
||||
target->nNumOfElements = source->nNumOfElements;
|
||||
@@ -1963,7 +1965,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
|
||||
zend_array_dup_packed_elements(source, target, 1);
|
||||
}
|
||||
} else {
|
||||
HT_FLAGS(target) = HT_FLAGS(source);
|
||||
HT_FLAGS(target) = HT_FLAGS(source) & HASH_FLAG_MASK;
|
||||
target->nTableMask = source->nTableMask;
|
||||
target->nNextFreeElement = source->nNextFreeElement;
|
||||
target->nInternalPointer =
|
||||
|
||||
@@ -40,6 +40,9 @@
|
||||
#define HASH_FLAG_HAS_EMPTY_IND (1<<5)
|
||||
#define HASH_FLAG_ALLOW_COW_VIOLATION (1<<6)
|
||||
|
||||
/* Only the low byte are real flags */
|
||||
#define HASH_FLAG_MASK 0xff
|
||||
|
||||
#define HT_FLAGS(ht) (ht)->u.flags
|
||||
|
||||
#define HT_IS_PACKED(ht) \
|
||||
|
||||
@@ -208,8 +208,8 @@ static int zend_do_perform_type_hint_check(const zend_function *fe, zend_arg_inf
|
||||
fe_class_name = ZEND_TYPE_NAME(fe_arg_info->type);
|
||||
class_name = ZSTR_VAL(fe_class_name);
|
||||
class_name_len = ZSTR_LEN(fe_class_name);
|
||||
if (class_name_len == sizeof("parent")-1 && !strcasecmp(class_name, "parent") && proto->common.scope) {
|
||||
fe_class_name = zend_string_copy(proto->common.scope->name);
|
||||
if (class_name_len == sizeof("parent")-1 && !strcasecmp(class_name, "parent") && fe->common.scope && fe->common.scope->parent) {
|
||||
fe_class_name = zend_string_copy(fe->common.scope->parent->name);
|
||||
} else if (class_name_len == sizeof("self")-1 && !strcasecmp(class_name, "self") && fe->common.scope) {
|
||||
fe_class_name = zend_string_copy(fe->common.scope->name);
|
||||
} else {
|
||||
|
||||
+221
-220
File diff suppressed because it is too large.
Load diff
@@ -1781,7 +1781,8 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
char *end;
|
||||
if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */
|
||||
errno = 0;
|
||||
ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, &end, 0));
|
||||
/* base must be passed explicitly for correct parse error on Windows */
|
||||
ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, &end, yytext[0] == '0' ? 8 : 10));
|
||||
/* This isn't an assert, we need to ensure 019 isn't valid octal
|
||||
* Because the lexing itself doesn't do that for us
|
||||
*/
|
||||
|
||||
+15
-1
@@ -234,7 +234,13 @@ static zend_string* ZEND_FASTCALL zend_new_interned_string_request(zend_string *
|
||||
}
|
||||
|
||||
/* Create a short living interned, freed after the request. */
|
||||
ZEND_ASSERT(!(GC_FLAGS(str) & GC_PERSISTENT));
|
||||
#if ZEND_RC_DEBUG
|
||||
if (zend_rc_debug) {
|
||||
/* PHP shouldn't create persistent interned string during request,
|
||||
* but at least dl() may do this */
|
||||
ZEND_ASSERT(!(GC_FLAGS(str) & GC_PERSISTENT));
|
||||
}
|
||||
#endif
|
||||
if (GC_REFCOUNT(str) > 1) {
|
||||
zend_ulong h = ZSTR_H(str);
|
||||
zend_string_delref(str);
|
||||
@@ -257,6 +263,7 @@ static zend_string* ZEND_FASTCALL zend_string_init_interned_permanent(const char
|
||||
return ret;
|
||||
}
|
||||
|
||||
ZEND_ASSERT(permanent);
|
||||
ret = zend_string_init(str, size, permanent);
|
||||
ZSTR_H(ret) = h;
|
||||
return zend_add_interned_string(ret, &interned_strings_permanent, IS_STR_PERMANENT);
|
||||
@@ -278,6 +285,13 @@ static zend_string* ZEND_FASTCALL zend_string_init_interned_request(const char *
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if ZEND_RC_DEBUG
|
||||
if (zend_rc_debug) {
|
||||
/* PHP shouldn't create persistent interned string during request,
|
||||
* but at least dl() may do this */
|
||||
ZEND_ASSERT(!permanent);
|
||||
}
|
||||
#endif
|
||||
ret = zend_string_init(str, size, permanent);
|
||||
ZSTR_H(ret) = h;
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
|
||||
set SDK_REMOTE=https://github.com/OSTC/php-sdk-binary-tools.git
|
||||
set SDK_REMOTE=https://github.com/Microsoft/php-sdk-binary-tools.git
|
||||
set SDK_BRANCH=%PHP_BUILD_SDK_BRANCH%
|
||||
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-%PHP_BUILD_CRT%-%PLATFORM%.bat
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
|
||||
set BRANCH=master
|
||||
)
|
||||
set STABILITY=staging
|
||||
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%BRANCH%-%PHP_SDK_VC%-%PHP_SDK_ARCH%
|
||||
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%BRANCH%-%PHP_SDK_VS%-%PHP_SDK_ARCH%
|
||||
rem SDK is cached, deps info is cached as well
|
||||
echo Updating dependencies in %DEPS_DIR%
|
||||
cmd /c phpsdk_deps --update --no-backup --branch %BRANCH% --stability %STABILITY% --deps %DEPS_DIR% --crt %PHP_BUILD_CRT%
|
||||
|
||||
@@ -11,7 +11,7 @@ if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
|
||||
set BRANCH=master
|
||||
set STABILITY=staging
|
||||
)
|
||||
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%BRANCH%-%PHP_SDK_VC%-%PHP_SDK_ARCH%
|
||||
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%BRANCH%-%PHP_SDK_VS%-%PHP_SDK_ARCH%
|
||||
if not exist "%DEPS_DIR%" (
|
||||
echo "%DEPS_DIR%" doesn't exist
|
||||
exit /b 3
|
||||
@@ -27,7 +27,7 @@ set PDO_MYSQL_TEST_USER=%MYSQL_TEST_USER%
|
||||
set PDO_MYSQL_TEST_PASS=%MYSQL_PWD%
|
||||
set PDO_MYSQL_TEST_HOST=%MYSQL_TEST_HOST%
|
||||
set PDO_MYSQL_TEST_PORT=%MYSQL_TEST_PORT%
|
||||
set PDO_MYSQL_TEST_DSN=mysql:host=%PDO_MYSQL_TEST_HOST% port=%PDO_MYSQL_TEST_PORT% dbname=test user=%PDO_MYSQL_TEST_USER% password=%MYSQL_PW%
|
||||
set PDO_MYSQL_TEST_DSN=mysql:host=%PDO_MYSQL_TEST_HOST%;port=%PDO_MYSQL_TEST_PORT%;dbname=test;user=%PDO_MYSQL_TEST_USER%;password=%MYSQL_PW%
|
||||
"C:\Program Files\MySql\MySQL Server 5.7\bin\mysql.exe" --user=%MYSQL_TEST_USER% -e "CREATE DATABASE IF NOT EXISTS test"
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
@@ -58,7 +58,7 @@ rem set OPENSSL_CONF=
|
||||
rem set SSLEAY_CONF=
|
||||
|
||||
rem prepare for Opcache
|
||||
if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enabled=1 -d opcache.enable_cli=1
|
||||
if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1
|
||||
|
||||
rem prepare for enchant
|
||||
mkdir c:\enchant_plugins
|
||||
|
||||
+2
-2
@@ -107,8 +107,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=7
|
||||
PHP_MINOR_VERSION=3
|
||||
PHP_RELEASE_VERSION=5
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=7
|
||||
PHP_EXTRA_VERSION="RC1"
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
@@ -1130,6 +1130,7 @@ PHP_MINIT_FUNCTION(curl)
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x071306 /* Available since 7.19.6 */
|
||||
REGISTER_CURL_CONSTANT(CURL_VERSION_CURLDEBUG);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_SSH_KNOWNHOSTS);
|
||||
#endif
|
||||
|
||||
@@ -1334,6 +1335,7 @@ PHP_MINIT_FUNCTION(curl)
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x072f00 /* Available since 7.47.0 */
|
||||
REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_2TLS);
|
||||
REGISTER_CURL_CONSTANT(CURL_VERSION_PSL);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x073000 /* Available since 7.48.0 */
|
||||
@@ -1452,6 +1454,10 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_TLS13_CIPHERS);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x074001 /* Available since 7.64.1 */
|
||||
REGISTER_CURL_CONSTANT(CURL_VERSION_ALTSVC);
|
||||
#endif
|
||||
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_SAFE_UPLOAD);
|
||||
|
||||
#ifdef PHP_CURL_NEED_OPENSSL_TSL
|
||||
|
||||
+1
-1
@@ -228,7 +228,7 @@ PHP_FUNCTION(curl_multi_select)
|
||||
}
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x071c00 /* Available since 7.28.0 */
|
||||
error = curl_multi_wait(mh->multi, NULL, 0, (unsigned long) timeout * 1000.0, &numfds);
|
||||
error = curl_multi_wait(mh->multi, NULL, 0, (unsigned long) (timeout * 1000.0), &numfds);
|
||||
if (CURLM_OK != error) {
|
||||
SAVE_CURLM_ERROR(mh, error);
|
||||
RETURN_LONG(-1);
|
||||
|
||||
@@ -17,6 +17,8 @@ const IGNORED_CONSTANTS = [
|
||||
'CURLOPT_PROGRESSDATA'
|
||||
];
|
||||
|
||||
const CONSTANTS_REGEX_PATTERN = '~^CURL(?:OPT|_VERSION)_[A-Z0-9_]+$~';
|
||||
|
||||
$curlConstants = getCurlConstants();
|
||||
$sourceConstants = getSourceConstants();
|
||||
|
||||
@@ -157,13 +159,8 @@ function getCurlConstants() : array
|
||||
$deprecated = $match[3] ?? null;
|
||||
$removed = $match[4] ?? null;
|
||||
|
||||
if (strpos($name, 'CURLOPT_') !== 0) {
|
||||
// not a CURLOPT_* constant
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($name, IGNORED_CONSTANTS)) {
|
||||
// purposefully ignored constant
|
||||
if (in_array($name, IGNORED_CONSTANTS, true) || !preg_match(CONSTANTS_REGEX_PATTERN, $name)) {
|
||||
// not a wanted constant
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -197,8 +194,8 @@ function getSourceConstants() : array
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strpos($name, 'CURLOPT_') !== 0) {
|
||||
// not a CURLOPT_* constant
|
||||
if (!preg_match(CONSTANTS_REGEX_PATTERN, $name)) {
|
||||
// not a wanted constant
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
--TEST--
|
||||
Request #72189 (Add missing CURL_VERSION_* constants)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
|
||||
include 'skipif.inc';
|
||||
|
||||
$version = curl_version();
|
||||
|
||||
if ($version['version_number'] < 0x071306) {
|
||||
exit('skip: test works only with curl >= 7.19.6');
|
||||
}
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$version = curl_version();
|
||||
|
||||
$bitfields = [
|
||||
CURL_VERSION_ASYNCHDNS,
|
||||
CURL_VERSION_CONV,
|
||||
CURL_VERSION_CURLDEBUG,
|
||||
CURL_VERSION_DEBUG,
|
||||
CURL_VERSION_GSSNEGOTIATE,
|
||||
CURL_VERSION_IDN,
|
||||
CURL_VERSION_IPV6,
|
||||
CURL_VERSION_KERBEROS4,
|
||||
CURL_VERSION_LARGEFILE,
|
||||
CURL_VERSION_LIBZ,
|
||||
CURL_VERSION_NTLM,
|
||||
CURL_VERSION_SPNEGO,
|
||||
CURL_VERSION_SSL,
|
||||
CURL_VERSION_SSPI,
|
||||
];
|
||||
|
||||
$matchesCount = 0;
|
||||
|
||||
foreach ($bitfields as $feature) {
|
||||
if ($version['features'] & $feature) {
|
||||
++$matchesCount;
|
||||
}
|
||||
}
|
||||
|
||||
var_dump($matchesCount > 0);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -43,7 +43,7 @@ TLS-SRP => No
|
||||
HTTP2 => Yes
|
||||
GSSAPI => No
|
||||
KERBEROS5 => Yes
|
||||
UNIX_SOCKETS => No
|
||||
UNIX_SOCKETS => %r(Yes|No)%r
|
||||
PSL => No
|
||||
HTTPS_PROXY => Yes
|
||||
MULTI_SSL => %s
|
||||
|
||||
@@ -26,5 +26,5 @@ curl_close($ch);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "%r(Couldn't resolve proxy|Could not resolve proxy:|Could not resolve host:|Could not resolve:)%r %s"
|
||||
string(%d) "%r(Couldn't resolve proxy|Could not resolve proxy:|Could not resolve host:|Could not resolve:|Unsupported proxy syntax in)%r %s"
|
||||
int(5)
|
||||
+38
-3
@@ -4639,6 +4639,10 @@ PHP_METHOD(DatePeriod, __construct)
|
||||
dpobj->end = clone;
|
||||
}
|
||||
}
|
||||
|
||||
if (dpobj->end == NULL && recurrences < 1) {
|
||||
php_error_docref(NULL, E_WARNING, "The recurrence count '%d' is invalid. Needs to be > 0", (int) recurrences);
|
||||
}
|
||||
|
||||
/* options */
|
||||
dpobj->include_start_date = !(options & PHP_DATE_PERIOD_EXCLUDE_START_DATE);
|
||||
@@ -5303,12 +5307,35 @@ PHP_METHOD(DatePeriod, __wakeup)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ date_period_is_magic_property
|
||||
* Common for date_period_read_property() and date_period_write_property() functions
|
||||
*/
|
||||
static int date_period_is_magic_property(zend_string *name)
|
||||
{
|
||||
if (zend_string_equals_literal(name, "recurrences")
|
||||
|| zend_string_equals_literal(name, "include_start_date")
|
||||
|| zend_string_equals_literal(name, "start")
|
||||
|| zend_string_equals_literal(name, "current")
|
||||
|| zend_string_equals_literal(name, "end")
|
||||
|| zend_string_equals_literal(name, "interval")
|
||||
) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ date_period_read_property */
|
||||
static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
|
||||
{
|
||||
if (type != BP_VAR_IS && type != BP_VAR_R) {
|
||||
zend_throw_error(NULL, "Retrieval of DatePeriod properties for modification is unsupported");
|
||||
return &EG(uninitialized_zval);
|
||||
zend_string *name = zval_get_string(member);
|
||||
if (date_period_is_magic_property(name)) {
|
||||
zend_throw_error(NULL, "Retrieval of DatePeriod->%s for modification is unsupported", ZSTR_VAL(name));
|
||||
zend_string_release(name);
|
||||
return &EG(uninitialized_zval);
|
||||
}
|
||||
zend_string_release(name);
|
||||
}
|
||||
|
||||
Z_OBJPROP_P(object); /* build properties hash table */
|
||||
@@ -5320,7 +5347,15 @@ static zval *date_period_read_property(zval *object, zval *member, int type, voi
|
||||
/* {{{ date_period_write_property */
|
||||
static void date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot)
|
||||
{
|
||||
zend_throw_error(NULL, "Writing to DatePeriod properties is unsupported");
|
||||
zend_string *name = zval_get_string(member);
|
||||
if (date_period_is_magic_property(name)) {
|
||||
zend_throw_error(NULL, "Writing to DatePeriod->%s is unsupported", ZSTR_VAL(name));
|
||||
zend_string_release(name);
|
||||
return;
|
||||
}
|
||||
zend_string_release(name);
|
||||
|
||||
std_object_handlers.write_property(object, member, value, cache_slot);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
--TEST--
|
||||
DatePeriod: Test read only properties
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$start = new DateTime;
|
||||
$interval = new DateInterval('P1D');
|
||||
$end = new DateTime;
|
||||
$period = new DatePeriod($start, $interval, $end);
|
||||
|
||||
echo "recurrences: ";
|
||||
var_dump($period->recurrences);
|
||||
|
||||
echo "include_start_date: ";
|
||||
var_dump($period->include_start_date);
|
||||
|
||||
echo "start: ";
|
||||
var_dump($period->start == $start);
|
||||
|
||||
echo "current: ";
|
||||
var_dump($period->current);
|
||||
|
||||
echo "end: ";
|
||||
var_dump($period->end == $end);
|
||||
|
||||
echo "interval: ";
|
||||
var_dump($period->interval->format("%R%d"));
|
||||
?>
|
||||
--EXPECT--
|
||||
recurrences: int(1)
|
||||
include_start_date: bool(true)
|
||||
start: bool(true)
|
||||
current: NULL
|
||||
end: bool(true)
|
||||
interval: string(2) "+1"
|
||||
@@ -0,0 +1,46 @@
|
||||
--TEST--
|
||||
DatePeriod: Test cannot modify read only properties
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$period = new DatePeriod(new DateTime, new DateInterval('P1D'), new DateTime);
|
||||
|
||||
$properties = [
|
||||
"recurrences",
|
||||
"include_start_date",
|
||||
"start",
|
||||
"current",
|
||||
"end",
|
||||
"interval",
|
||||
];
|
||||
|
||||
foreach ($properties as $property) {
|
||||
try {
|
||||
$period->$property = "new";
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
try {
|
||||
$period->$property[] = "extra";
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Writing to DatePeriod->recurrences is unsupported
|
||||
Retrieval of DatePeriod->recurrences for modification is unsupported
|
||||
Writing to DatePeriod->include_start_date is unsupported
|
||||
Retrieval of DatePeriod->include_start_date for modification is unsupported
|
||||
Writing to DatePeriod->start is unsupported
|
||||
Retrieval of DatePeriod->start for modification is unsupported
|
||||
Writing to DatePeriod->current is unsupported
|
||||
Retrieval of DatePeriod->current for modification is unsupported
|
||||
Writing to DatePeriod->end is unsupported
|
||||
Retrieval of DatePeriod->end for modification is unsupported
|
||||
Writing to DatePeriod->interval is unsupported
|
||||
Retrieval of DatePeriod->interval for modification is unsupported
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
DatePeriod: Test wrong recurrence parameter on __construct
|
||||
--FILE--
|
||||
<?php
|
||||
try {
|
||||
new DatePeriod(new DateTime('yesterday'), new DateInterval('P1D'), 0);
|
||||
} catch (Exception $exception) {
|
||||
echo $exception->getMessage(), "\n";
|
||||
}
|
||||
|
||||
try {
|
||||
new DatePeriod(new DateTime('yesterday'), new DateInterval('P1D'),-1);
|
||||
} catch (Exception $exception) {
|
||||
echo $exception->getMessage(), "\n";
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
DatePeriod::__construct(): The recurrence count '0' is invalid. Needs to be > 0
|
||||
DatePeriod::__construct(): The recurrence count '-1' is invalid. Needs to be > 0
|
||||
@@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
Test for bug #65672: Broken classes inherited from DatePeriod
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$interval = new DateInterval('P1D');
|
||||
$period = new class(new DateTime, $interval, new DateTime) extends DatePeriod {
|
||||
public $extra = "stuff";
|
||||
};
|
||||
|
||||
var_dump($period->extra);
|
||||
$period->extra = "modified";
|
||||
var_dump($period->extra);
|
||||
|
||||
# Ensure we can modify properties (retrieve for write)
|
||||
$period->extra = [];
|
||||
$period->extra[] = "array";
|
||||
var_dump($period->extra);
|
||||
|
||||
var_dump(isset($period->dynamic1));
|
||||
$period->dynamic1 = "dynamic";
|
||||
var_dump($period->dynamic1);
|
||||
|
||||
# Ensure we can modify properties (retrieve for write)
|
||||
$period->dynamic2 = [];
|
||||
$period->dynamic2[] = "array";
|
||||
var_dump($period->dynamic2);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(5) "stuff"
|
||||
string(8) "modified"
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(5) "array"
|
||||
}
|
||||
bool(false)
|
||||
string(7) "dynamic"
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(5) "array"
|
||||
}
|
||||
@@ -50,7 +50,7 @@ int dom_documenttype_name_read(dom_object *obj, zval *retval)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ZVAL_STRING(retval, (char *) (dtdptr->name));
|
||||
ZVAL_STRING(retval, dtdptr->name ? (char *) (dtdptr->name) : "");
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #78025 (segfault when accessing properties of DOMDocumentType)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('dom')) die('skip dom extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$htm = "<!DOCTYPE><html></html>";
|
||||
$dom = new DOMDocument;
|
||||
$dom->loadHTML($htm);
|
||||
var_dump($dom->doctype->name);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: DOMDocument::loadHTML(): htmlParseDocTypeDecl : no DOCTYPE name ! in Entity, line: 1 in %s on line %d
|
||||
string(0) ""
|
||||
===DONE===
|
||||
+3
-1
@@ -3277,7 +3277,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
offset_base is ImageInfo->file.list[sn].data-dir_offset
|
||||
dir_entry - offset_base is dir_offset+2+i*12
|
||||
*/
|
||||
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base)) {
|
||||
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base) || dir_entry <= offset_base) {
|
||||
/* It is important to check for IMAGE_FILETYPE_TIFF
|
||||
* JPEG does not use absolute pointers instead its pointers are
|
||||
* relative to the start of the TIFF header in APP1 section. */
|
||||
@@ -3920,6 +3920,8 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
|
||||
if (c == 0xFF)
|
||||
return FALSE;
|
||||
marker = c;
|
||||
if (pos>=ImageInfo->Thumbnail.size)
|
||||
return FALSE;
|
||||
length = php_jpg_get16(data+pos);
|
||||
if (length > ImageInfo->Thumbnail.size || pos >= ImageInfo->Thumbnail.size - length) {
|
||||
return FALSE;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #77950 (Heap-buffer-overflow in _estrndup via exif_process_IFD_TAG)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
exif_read_data(__DIR__."/bug77950.tiff");
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
%A
|
||||
DONE
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug #77988 (heap-buffer-overflow on php_jpg_get16)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
exif_read_data(__DIR__."/bug77988.jpg", 'COMMENT', FALSE, TRUE);
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
DONE
|
||||
+5
-1
@@ -4623,7 +4623,11 @@ PHP_FUNCTION(imageantialias)
|
||||
if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
gdImageSetAntiAliased(im, 0);
|
||||
|
||||
if (im->trueColor) {
|
||||
im->AA = alias;
|
||||
}
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -136,7 +136,11 @@ gdImagePtr gdImageCreateFromXbm(FILE * fd)
|
||||
}
|
||||
h[3] = ch;
|
||||
}
|
||||
sscanf(h, "%x", &b);
|
||||
if (sscanf(h, "%x", &b) != 1) {
|
||||
gd_error("invalid XBM");
|
||||
gdImageDestroy(im);
|
||||
return 0;
|
||||
}
|
||||
for (bit = 1; bit <= max_bit; bit = bit << 1) {
|
||||
gdImageSetPixel(im, x++, y, (b & bit) ? 1 : 0);
|
||||
if (x == im->sx) {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #77943 (imageantialias($image, false); does not work)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . '/func.inc';
|
||||
|
||||
$width = 400;
|
||||
$height = 300;
|
||||
$im = imagecreatetruecolor($width, $height);
|
||||
$white = imagecolorallocate($im, 255, 255, 255);
|
||||
$blue = imagecolorallocate($im, 0, 0, 255);
|
||||
|
||||
imageantialias($im, false);
|
||||
imagefilledrectangle($im, 0, 0, $width-1, $height-1, $white);
|
||||
|
||||
imageline($im, 0, 0, $width, $height, $blue);
|
||||
imagesetthickness($im, 3);
|
||||
imageline($im, 10, 0, $width, $height-10, $blue);
|
||||
|
||||
test_image_equals_file(__DIR__ . '/bug77943.png', $im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images are equal.
|
||||
===DONE===
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #77973 (Uninitialized read in gdImageCreateFromXbm)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available");
|
||||
if (!function_exists('imagecreatefromxbm')) die("skip imagecreatefromxbm not available");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$contents = hex2bin("23646566696e6520776964746820320a23646566696e652068656967687420320a737461746963206368617220626974735b5d203d7b0a7a7a787a7a");
|
||||
$filepath = __DIR__ . '/bug77973.xbm';
|
||||
file_put_contents($filepath, $contents);
|
||||
$im = imagecreatefromxbm($filepath);
|
||||
var_dump($im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: imagecreatefromxbm(): invalid XBM in %s on line %d
|
||||
|
||||
Warning: imagecreatefromxbm(): '%s' is not a valid XBM file in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__ . '/bug77973.xbm');
|
||||
?>
|
||||
+3
-1
@@ -1663,7 +1663,9 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
|
||||
* we can do at this point. */
|
||||
if (*(p1 + 1) == '=') {
|
||||
++p1;
|
||||
--str_left;
|
||||
if (str_left > 1) {
|
||||
--str_left;
|
||||
}
|
||||
}
|
||||
|
||||
err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #78069 (Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('iconv')) die('skip ext/iconv required');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$hdr = iconv_mime_decode_headers(file_get_contents(__DIR__ . "/bug78069.data"),2);
|
||||
var_dump(count($hdr));
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
int(1)
|
||||
DONE
|
||||
@@ -1538,11 +1538,17 @@ PHP_FUNCTION(locale_lookup)
|
||||
|
||||
intl_error_reset( NULL );
|
||||
|
||||
if(zend_parse_parameters( ZEND_NUM_ARGS(), "as|bS", &arr, &loc_range, &loc_range_len,
|
||||
#if U_ICU_VERSION_MAJOR_NUM > 63
|
||||
# define BANG "!"
|
||||
#else
|
||||
# define BANG
|
||||
#endif
|
||||
if(zend_parse_parameters( ZEND_NUM_ARGS(), "as|bS" BANG, &arr, &loc_range, &loc_range_len,
|
||||
&boolCanonical, &fallback_loc_str) == FAILURE) {
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_lookup: unable to parse input params", 0 );
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#undef BANG
|
||||
|
||||
if(loc_range_len == 0) {
|
||||
if(fallback_loc_str) {
|
||||
|
||||
@@ -3,6 +3,7 @@ IntlBreakIterator::getLocale(): basic test
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '64.0') >= 0) die('skip for ICU < 64.0'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
IntlBreakIterator::getLocale(): basic test
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '64.0') < 0) die('skip for ICU >= 64.0'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
ini_set("intl.default_locale", "pt_PT");
|
||||
|
||||
$bi = IntlBreakIterator::createSentenceInstance('pt');
|
||||
|
||||
var_dump($bi->getLocale(0));
|
||||
var_dump($bi->getLocale(1));
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
string(0) ""
|
||||
string(2) "pt"
|
||||
==DONE==
|
||||
@@ -99,9 +99,9 @@ disp_locale=fr : display_language=ukrainien
|
||||
disp_locale=de : display_language=Ukrainisch
|
||||
-----------------
|
||||
locale='root'
|
||||
disp_locale=en : display_language=Root
|
||||
disp_locale=fr : display_language=racine
|
||||
disp_locale=de : display_language=[rR]oot
|
||||
disp_locale=en : display_language=(Root|Unknown language)
|
||||
disp_locale=fr : display_language=(racine|langue indéterminée)
|
||||
disp_locale=de : display_language=([rR]oot|Unbekannte Sprache)
|
||||
-----------------
|
||||
locale='uk@currency=EURO'
|
||||
disp_locale=en : display_language=Ukrainian
|
||||
|
||||
@@ -3,6 +3,7 @@ locale_get_display_name() icu >= 53.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '64.0') >= 0) die('skip for ICU < 64.0'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,342 @@
|
||||
--TEST--
|
||||
locale_get_display_name() icu >= 64.0
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '64.0') < 0) die('skip for ICU >= 64.0'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Try getting the display_name for different locales
|
||||
* with Procedural and Object methods.
|
||||
*/
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$res_str='';
|
||||
|
||||
$disp_locales=array('en','fr','de');
|
||||
|
||||
$locales = array(
|
||||
'sl_IT_nedis_KIRTI',
|
||||
'sl_IT_nedis-a-kirti-x-xyz',
|
||||
'sl_IT_rozaj',
|
||||
'sl_IT_NEDIS_ROJAZ_1901',
|
||||
'i-enochian',
|
||||
'zh-hakka',
|
||||
'zh-wuu',
|
||||
'i-tay',
|
||||
'sgn-BE-nl',
|
||||
'sgn-CH-de',
|
||||
'sl_IT_rozaj@currency=EUR',
|
||||
'uk-ua_CALIFORNIA@currency=;currency=GRN',
|
||||
'root',
|
||||
'uk@currency=EURO',
|
||||
'Hindi',
|
||||
//Simple language subtag
|
||||
'de',
|
||||
'fr',
|
||||
'ja',
|
||||
'i-enochian', //(example of a grandfathered tag)
|
||||
//Language subtag plus Script subtag:
|
||||
'zh-Hant',
|
||||
'zh-Hans',
|
||||
'sr-Cyrl',
|
||||
'sr-Latn',
|
||||
//Language-Script-Region
|
||||
'zh-Hans-CN',
|
||||
'sr-Latn-CS',
|
||||
//Language-Variant
|
||||
'sl-rozaj',
|
||||
'sl-nedis',
|
||||
//Language-Region-Variant
|
||||
'de-CH-1901',
|
||||
'sl-IT-nedis',
|
||||
//Language-Script-Region-Variant
|
||||
'sl-Latn-IT-nedis',
|
||||
//Language-Region:
|
||||
'de-DE',
|
||||
'en-US',
|
||||
'es-419',
|
||||
//Private use subtags:
|
||||
'de-CH-x-phonebk',
|
||||
'az-Arab-x-AZE-derbend',
|
||||
//Extended language subtags
|
||||
'zh-min',
|
||||
'zh-min-nan-Hant-CN',
|
||||
//Private use registry values
|
||||
'x-whatever',
|
||||
'qaa-Qaaa-QM-x-southern',
|
||||
'sr-Latn-QM',
|
||||
'sr-Qaaa-CS',
|
||||
/*Tags that use extensions (examples ONLY: extensions MUST be defined
|
||||
by revision or update to this document or by RFC): */
|
||||
'en-US-u-islamCal',
|
||||
'zh-CN-a-myExt-x-private',
|
||||
'en-a-myExt-b-another',
|
||||
//Some Invalid Tags:
|
||||
'de-419-DE',
|
||||
'a-DE',
|
||||
'ar-a-aaa-b-bbb-a-ccc'
|
||||
);
|
||||
|
||||
|
||||
$res_str = '';
|
||||
|
||||
foreach( $locales as $locale )
|
||||
{
|
||||
$res_str .= "locale='$locale'\n";
|
||||
foreach( $disp_locales as $disp_locale )
|
||||
{
|
||||
$scr = ut_loc_get_display_name( $locale ,$disp_locale );
|
||||
$scr = str_replace(array('(', ')'), '#', $scr);
|
||||
$res_str .= "disp_locale=$disp_locale : display_name=$scr";
|
||||
$res_str .= "\n";
|
||||
}
|
||||
$res_str .= "-----------------\n";
|
||||
}
|
||||
|
||||
return $res_str;
|
||||
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
locale='sl_IT_nedis_KIRTI'
|
||||
disp_locale=en : display_name=Slovenian #Italy, NEDIS_KIRTI#
|
||||
disp_locale=fr : display_name=slovène #Italie, NEDIS_KIRTI#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_KIRTI#
|
||||
-----------------
|
||||
locale='sl_IT_nedis-a-kirti-x-xyz'
|
||||
disp_locale=en : display_name=Slovenian #Italy, NEDIS_A_KIRTI_X_XYZ#
|
||||
disp_locale=fr : display_name=slovène #Italie, NEDIS_A_KIRTI_X_XYZ#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_A_KIRTI_X_XYZ#
|
||||
-----------------
|
||||
locale='sl_IT_rozaj'
|
||||
disp_locale=en : display_name=Slovenian #Italy, Resian#
|
||||
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch)#
|
||||
-----------------
|
||||
locale='sl_IT_NEDIS_ROJAZ_1901'
|
||||
disp_locale=en : display_name=Slovenian #Italy, NEDIS_ROJAZ_1901#
|
||||
disp_locale=fr : display_name=slovène #Italie, NEDIS_ROJAZ_1901#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_ROJAZ_1901#
|
||||
-----------------
|
||||
locale='i-enochian'
|
||||
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
|
||||
disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian#
|
||||
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
|
||||
-----------------
|
||||
locale='zh-hakka'
|
||||
disp_locale=en : display_name=Chinese( #HAKKA#)?
|
||||
disp_locale=fr : display_name=chinois( #HAKKA#)?
|
||||
disp_locale=de : display_name=Chinesisch( #HAKKA#)?
|
||||
-----------------
|
||||
locale='zh-wuu'
|
||||
disp_locale=en : display_name=Chinese #WUU#
|
||||
disp_locale=fr : display_name=chinois #WUU#
|
||||
disp_locale=de : display_name=Chinesisch #WUU#
|
||||
-----------------
|
||||
locale='i-tay'
|
||||
disp_locale=en : display_name=i-tay
|
||||
disp_locale=fr : display_name=i-tay
|
||||
disp_locale=de : display_name=i-tay
|
||||
-----------------
|
||||
locale='sgn-BE-nl'
|
||||
disp_locale=en : display_name=sgn #Belgium, NL#
|
||||
disp_locale=fr : display_name=sgn #Belgique, NL#
|
||||
disp_locale=de : display_name=sgn #Belgien, NL#
|
||||
-----------------
|
||||
locale='sgn-CH-de'
|
||||
disp_locale=en : display_name=sgn #Switzerland, DE#
|
||||
disp_locale=fr : display_name=sgn #Suisse, DE#
|
||||
disp_locale=de : display_name=sgn #Schweiz, DE#
|
||||
-----------------
|
||||
locale='sl_IT_rozaj@currency=EUR'
|
||||
disp_locale=en : display_name=Slovenian #Italy, Resian, [Cc]urrency=Euro#
|
||||
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia, [Dd]evise=euro#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch), Währung=Euro#
|
||||
-----------------
|
||||
locale='uk-ua_CALIFORNIA@currency=;currency=GRN'
|
||||
disp_locale=en : display_name=
|
||||
disp_locale=fr : display_name=
|
||||
disp_locale=de : display_name=
|
||||
-----------------
|
||||
locale='root'
|
||||
disp_locale=en : display_name=Unknown language
|
||||
disp_locale=fr : display_name=langue indéterminée
|
||||
disp_locale=de : display_name=Unbekannte Sprache
|
||||
-----------------
|
||||
locale='uk@currency=EURO'
|
||||
disp_locale=en : display_name=Ukrainian #[Cc]urrency=EURO#
|
||||
disp_locale=fr : display_name=ukrainien #[Dd]evise=EURO#
|
||||
disp_locale=de : display_name=Ukrainisch #Währung=EURO#
|
||||
-----------------
|
||||
locale='Hindi'
|
||||
disp_locale=en : display_name=hindi
|
||||
disp_locale=fr : display_name=hindi
|
||||
disp_locale=de : display_name=hindi
|
||||
-----------------
|
||||
locale='de'
|
||||
disp_locale=en : display_name=German
|
||||
disp_locale=fr : display_name=allemand
|
||||
disp_locale=de : display_name=Deutsch
|
||||
-----------------
|
||||
locale='fr'
|
||||
disp_locale=en : display_name=French
|
||||
disp_locale=fr : display_name=français
|
||||
disp_locale=de : display_name=Französisch
|
||||
-----------------
|
||||
locale='ja'
|
||||
disp_locale=en : display_name=Japanese
|
||||
disp_locale=fr : display_name=japonais
|
||||
disp_locale=de : display_name=Japanisch
|
||||
-----------------
|
||||
locale='i-enochian'
|
||||
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
|
||||
disp_locale=fr : display_name=i-enochian #Usage privé=i-enochian#
|
||||
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
|
||||
-----------------
|
||||
locale='zh-Hant'
|
||||
disp_locale=en : display_name=Chinese #Traditional#
|
||||
disp_locale=fr : display_name=chinois #traditionnel#
|
||||
disp_locale=de : display_name=Chinesisch #Traditionell#
|
||||
-----------------
|
||||
locale='zh-Hans'
|
||||
disp_locale=en : display_name=Chinese #Simplified#
|
||||
disp_locale=fr : display_name=chinois #simplifié#
|
||||
disp_locale=de : display_name=Chinesisch #Vereinfacht#
|
||||
-----------------
|
||||
locale='sr-Cyrl'
|
||||
disp_locale=en : display_name=Serbian #Cyrillic#
|
||||
disp_locale=fr : display_name=serbe #cyrillique#
|
||||
disp_locale=de : display_name=Serbisch #Kyrillisch#
|
||||
-----------------
|
||||
locale='sr-Latn'
|
||||
disp_locale=en : display_name=Serbian #Latin#
|
||||
disp_locale=fr : display_name=serbe #latin#
|
||||
disp_locale=de : display_name=Serbisch #Lateinisch#
|
||||
-----------------
|
||||
locale='zh-Hans-CN'
|
||||
disp_locale=en : display_name=Chinese #Simplified, China#
|
||||
disp_locale=fr : display_name=chinois #simplifié, Chine#
|
||||
disp_locale=de : display_name=Chinesisch #Vereinfacht, China#
|
||||
-----------------
|
||||
locale='sr-Latn-CS'
|
||||
disp_locale=en : display_name=Serbian #Latin, Serbia#
|
||||
disp_locale=fr : display_name=serbe #latin, Serbie#
|
||||
disp_locale=de : display_name=Serbisch #Lateinisch, Serbien#
|
||||
-----------------
|
||||
locale='sl-rozaj'
|
||||
disp_locale=en : display_name=Slovenian #Resian#
|
||||
disp_locale=fr : display_name=slovène #dialecte de Resia#
|
||||
disp_locale=de : display_name=Slowenisch( #(ROZAJ|Resianisch)#)?
|
||||
-----------------
|
||||
locale='sl-nedis'
|
||||
disp_locale=en : display_name=Slovenian #Natisone dialect#
|
||||
disp_locale=fr : display_name=slovène #dialecte de Natisone#
|
||||
disp_locale=de : display_name=Slowenisch #Natisone-Dialekt#
|
||||
-----------------
|
||||
locale='de-CH-1901'
|
||||
disp_locale=en : display_name=German #Switzerland, Traditional German orthography#
|
||||
disp_locale=fr : display_name=allemand #Suisse, orthographe allemande traditionnelle#
|
||||
disp_locale=de : display_name=Deutsch #Schweiz, (1901|[aA]lte deutsche Rechtschreibung)#
|
||||
-----------------
|
||||
locale='sl-IT-nedis'
|
||||
disp_locale=en : display_name=Slovenian #Italy, Natisone dialect#
|
||||
disp_locale=fr : display_name=slovène #Italie, dialecte de Natisone#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, (NEDIS|Natisone-Dialekt)#
|
||||
-----------------
|
||||
locale='sl-Latn-IT-nedis'
|
||||
disp_locale=en : display_name=Slovenian #Latin, Italy, Natisone dialect#
|
||||
disp_locale=fr : display_name=slovène #latin, Italie, dialecte de Natisone#
|
||||
disp_locale=de : display_name=Slowenisch #Lateinisch, Italien, (NEDIS|Natisone-Dialekt)#
|
||||
-----------------
|
||||
locale='de-DE'
|
||||
disp_locale=en : display_name=German #Germany#
|
||||
disp_locale=fr : display_name=allemand #Allemagne#
|
||||
disp_locale=de : display_name=Deutsch #Deutschland#
|
||||
-----------------
|
||||
locale='en-US'
|
||||
disp_locale=en : display_name=English #United States#
|
||||
disp_locale=fr : display_name=anglais #États-Unis#
|
||||
disp_locale=de : display_name=Englisch #Vereinigte Staaten#
|
||||
-----------------
|
||||
locale='es-419'
|
||||
disp_locale=en : display_name=Spanish #Latin America#
|
||||
disp_locale=fr : display_name=espagnol #Amérique latine#
|
||||
disp_locale=de : display_name=Spanisch #Lateinamerika#
|
||||
-----------------
|
||||
locale='de-CH-x-phonebk'
|
||||
disp_locale=en : display_name=German #Switzerland, Private-Use=phonebk#
|
||||
disp_locale=fr : display_name=allemand #Suisse, Usage privé=phonebk#
|
||||
disp_locale=de : display_name=Deutsch #Schweiz, Privatnutzung=phonebk#
|
||||
-----------------
|
||||
locale='az-Arab-x-AZE-derbend'
|
||||
disp_locale=en : display_name=Azerbaijani #Arabic, Private-Use=aze-derbend#
|
||||
disp_locale=fr : display_name=azéri #arabe, Usage privé=aze-derbend#
|
||||
disp_locale=de : display_name=Aserbaidschanisch #Arabisch, Privatnutzung=aze-derbend#
|
||||
-----------------
|
||||
locale='zh-min'
|
||||
disp_locale=en : display_name=Chinese #MIN#
|
||||
disp_locale=fr : display_name=chinois #MIN#
|
||||
disp_locale=de : display_name=Chinesisch #MIN#
|
||||
-----------------
|
||||
locale='zh-min-nan-Hant-CN'
|
||||
disp_locale=en : display_name=Chinese #MIN, NAN_HANT_CN#
|
||||
disp_locale=fr : display_name=chinois #MIN, NAN_HANT_CN#
|
||||
disp_locale=de : display_name=Chinesisch #MIN, NAN_HANT_CN#
|
||||
-----------------
|
||||
locale='x-whatever'
|
||||
disp_locale=en : display_name=x-whatever #Private-Use=whatever#
|
||||
disp_locale=fr : display_name=x-whatever #Usage privé=whatever#
|
||||
disp_locale=de : display_name=x-whatever #Privatnutzung=whatever#
|
||||
-----------------
|
||||
locale='qaa-Qaaa-QM-x-southern'
|
||||
disp_locale=en : display_name=qaa #Qaaa, QM, Private-Use=southern#
|
||||
disp_locale=fr : display_name=qaa #Qaaa, QM, Usage privé=southern#
|
||||
disp_locale=de : display_name=qaa #Qaaa, QM, Privatnutzung=southern#
|
||||
-----------------
|
||||
locale='sr-Latn-QM'
|
||||
disp_locale=en : display_name=Serbian #Latin, QM#
|
||||
disp_locale=fr : display_name=serbe #latin, QM#
|
||||
disp_locale=de : display_name=Serbisch #Lateinisch, QM#
|
||||
-----------------
|
||||
locale='sr-Qaaa-CS'
|
||||
disp_locale=en : display_name=Serbian #Qaaa, Serbia#
|
||||
disp_locale=fr : display_name=serbe #Qaaa, Serbie#
|
||||
disp_locale=de : display_name=Serbisch #Qaaa, Serbien#
|
||||
-----------------
|
||||
locale='en-US-u-islamCal'
|
||||
disp_locale=en : display_name=English #United States, attribute=islamcal#
|
||||
disp_locale=fr : display_name=anglais #États-Unis, attribute=islamcal#
|
||||
disp_locale=de : display_name=Englisch #Vereinigte Staaten, attribute=islamcal#
|
||||
-----------------
|
||||
locale='zh-CN-a-myExt-x-private'
|
||||
disp_locale=en : display_name=Chinese #China, a=myext, Private-Use=private#
|
||||
disp_locale=fr : display_name=chinois #Chine, a=myext, Usage privé=private#
|
||||
disp_locale=de : display_name=Chinesisch #China, a=myext, Privatnutzung=private#
|
||||
-----------------
|
||||
locale='en-a-myExt-b-another'
|
||||
disp_locale=en : display_name=English #a=myext, b=another#
|
||||
disp_locale=fr : display_name=anglais #a=myext, b=another#
|
||||
disp_locale=de : display_name=Englisch #a=myext, b=another#
|
||||
-----------------
|
||||
locale='de-419-DE'
|
||||
disp_locale=en : display_name=German #Latin America, DE#
|
||||
disp_locale=fr : display_name=allemand #Amérique latine, DE#
|
||||
disp_locale=de : display_name=Deutsch #Lateinamerika, DE#
|
||||
-----------------
|
||||
locale='a-DE'
|
||||
disp_locale=en : display_name=a #Germany#
|
||||
disp_locale=fr : display_name=a #Allemagne#
|
||||
disp_locale=de : display_name=a #Deutschland#
|
||||
-----------------
|
||||
locale='ar-a-aaa-b-bbb-a-ccc'
|
||||
disp_locale=en : display_name=Arabic #a=aaa, b=bbb#
|
||||
disp_locale=fr : display_name=arabe #a=aaa, b=bbb#
|
||||
disp_locale=de : display_name=Arabisch #a=aaa, b=bbb#
|
||||
-----------------
|
||||
@@ -83,9 +83,9 @@ include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
uk-ua_CALIFORNIA@currency=;currency=GRN: primary_language='uk'
|
||||
root: primary_language='root'
|
||||
root: primary_language='%S'
|
||||
uk@currency=EURO: primary_language='uk'
|
||||
Hindi: primary_language='hindi'
|
||||
de: primary_language='de'
|
||||
|
||||
@@ -96,13 +96,13 @@ include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
---------------------
|
||||
uk-ua_CALIFORNIA@currency=;currency=GRN:
|
||||
language : 'uk' , region : 'UA' , variant0 : 'CALIFORNIA' ,
|
||||
---------------------
|
||||
root:
|
||||
language : 'root' ,
|
||||
%s
|
||||
---------------------
|
||||
uk@currency=EURO:
|
||||
language : 'uk' ,
|
||||
|
||||
+10
-2
@@ -567,8 +567,16 @@ again:
|
||||
return php_json_encode_serializable_object(buf, val, options, encoder);
|
||||
}
|
||||
/* fallthrough -- Non-serializable object */
|
||||
case IS_ARRAY:
|
||||
return php_json_encode_array(buf, val, options, encoder);
|
||||
case IS_ARRAY: {
|
||||
/* Avoid modifications (and potential freeing) of the array through a reference when a
|
||||
* jsonSerialize() method is invoked. */
|
||||
zval zv;
|
||||
int res;
|
||||
ZVAL_COPY(&zv, val);
|
||||
res = php_json_encode_array(buf, &zv, options, encoder);
|
||||
zval_ptr_dtor_nogc(&zv);
|
||||
return res;
|
||||
}
|
||||
|
||||
case IS_REFERENCE:
|
||||
val = Z_REFVAL_P(val);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #77843: Use after free with json serializer
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class X implements JsonSerializable {
|
||||
public $prop = "value";
|
||||
public function jsonSerialize() {
|
||||
global $arr;
|
||||
unset($arr[0]);
|
||||
var_dump($this);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
$arr = [new X()];
|
||||
var_dump(json_encode([&$arr]));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(X)#1 (1) {
|
||||
["prop"]=>
|
||||
string(5) "value"
|
||||
}
|
||||
string(20) "[[{"prop":"value"}]]"
|
||||
@@ -0,0 +1,50 @@
|
||||
--TEST--
|
||||
ensure an error is returned when mysqli.allow_local_infile is off
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--INI--
|
||||
mysqli.allow_local_infile=0
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
}
|
||||
if (!$link->query("DROP TABLE IF EXISTS test")) {
|
||||
printf("[002] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
|
||||
printf("[003] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
if (FALSE == file_put_contents('bug77956.data', "waa? meukee!"))
|
||||
printf("[004] Failed to create CVS file\n");
|
||||
if (!$link->query("SELECT 1 FROM DUAL"))
|
||||
printf("[005] [%d] %s\n", $link->errno, $link->error);
|
||||
if (!$link->query("LOAD DATA LOCAL INFILE 'bug77956.data' INTO TABLE test")) {
|
||||
printf("[006] [%d] %s\n", $link->errno, $link->error);
|
||||
echo "done";
|
||||
} else {
|
||||
echo "bug";
|
||||
}
|
||||
$link->close();
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once('connect.inc');
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket);
|
||||
}
|
||||
if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
|
||||
printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
$link->close();
|
||||
unlink('bug77956.data');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: mysqli::query(): LOAD DATA LOCAL INFILE forbidden in %s on line %d
|
||||
[006] [2000] LOAD DATA LOCAL INFILE is forbidden, check mysqli.allow_local_infile
|
||||
done
|
||||
@@ -156,6 +156,8 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * const filenam
|
||||
|
||||
if (!(conn->options->flags & CLIENT_LOCAL_FILES)) {
|
||||
php_error_docref(NULL, E_WARNING, "LOAD DATA LOCAL INFILE forbidden");
|
||||
SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE,
|
||||
"LOAD DATA LOCAL INFILE is forbidden, check mysqli.allow_local_infile");
|
||||
/* write empty packet to server */
|
||||
ret = net->data->m.send(net, vio, empty_packet, 0, conn->stats, conn->error_info);
|
||||
*is_warning = TRUE;
|
||||
|
||||
@@ -612,7 +612,7 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie
|
||||
zval *parameter = &stmt->param_bind[i].zv;
|
||||
|
||||
ZVAL_DEREF(parameter);
|
||||
if (!Z_ISNULL_P(parameter) && (current_type == MYSQL_TYPE_LONG || current_type == MYSQL_TYPE_LONGLONG)) {
|
||||
if (!Z_ISNULL_P(parameter) && (current_type == MYSQL_TYPE_LONG || current_type == MYSQL_TYPE_LONGLONG || current_type == MYSQL_TYPE_TINY)) {
|
||||
/* always copy the var, because we do many conversions */
|
||||
if (Z_TYPE_P(parameter) != IS_LONG &&
|
||||
PASS != mysqlnd_stmt_copy_it(copies_param, parameter, stmt->param_count, i))
|
||||
@@ -825,6 +825,13 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies,
|
||||
int4store(*p, Z_LVAL_P(data));
|
||||
(*p) += 4;
|
||||
break;
|
||||
case MYSQL_TYPE_TINY:
|
||||
if (Z_TYPE_P(data) == IS_STRING) {
|
||||
goto send_string;
|
||||
}
|
||||
int1store(*p, Z_LVAL_P(data));
|
||||
(*p)++;
|
||||
break;
|
||||
case MYSQL_TYPE_LONG_BLOB:
|
||||
if (stmt->param_bind[i].flags & MYSQLND_PARAM_BIND_BLOB_USED) {
|
||||
stmt->param_bind[i].flags &= ~MYSQLND_PARAM_BIND_BLOB_USED;
|
||||
|
||||
@@ -294,13 +294,14 @@ void MYSQLND_METHOD(mysqlnd_res, free_result_contents_internal)(MYSQLND_RES * re
|
||||
{
|
||||
DBG_ENTER("mysqlnd_res::free_result_contents_internal");
|
||||
|
||||
result->m.free_result_buffers(result);
|
||||
|
||||
if (result->meta) {
|
||||
ZEND_ASSERT(zend_arena_contains(result->memory_pool->arena, result->meta));
|
||||
result->meta->m->free_metadata(result->meta);
|
||||
result->meta = NULL;
|
||||
}
|
||||
|
||||
result->m.free_result_buffers(result);
|
||||
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+148
-61
@@ -74,11 +74,7 @@
|
||||
* 16 of the SSA book.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#define SCP_DEBUG(...) php_printf(__VA_ARGS__)
|
||||
#else
|
||||
#define SCP_DEBUG(...)
|
||||
#endif
|
||||
#define SCP_DEBUG 0
|
||||
|
||||
typedef struct _sccp_ctx {
|
||||
scdf_ctx scdf;
|
||||
@@ -103,6 +99,24 @@ typedef struct _sccp_ctx {
|
||||
#define MAKE_TOP(zv) (Z_TYPE_INFO_P(zv) = TOP)
|
||||
#define MAKE_BOT(zv) (Z_TYPE_INFO_P(zv) = BOT)
|
||||
|
||||
static void scp_dump_value(zval *zv) {
|
||||
if (IS_TOP(zv)) {
|
||||
fprintf(stderr, " top");
|
||||
} else if (IS_BOT(zv)) {
|
||||
fprintf(stderr, " bot");
|
||||
} else if (Z_TYPE_P(zv) == IS_ARRAY || IS_PARTIAL_ARRAY(zv)) {
|
||||
fprintf(stderr, " %s[", IS_PARTIAL_ARRAY(zv) ? "partial " : "");
|
||||
zend_dump_ht(Z_ARRVAL_P(zv));
|
||||
fprintf(stderr, "]");
|
||||
} else if (IS_PARTIAL_OBJECT(zv)) {
|
||||
fprintf(stderr, " {");
|
||||
zend_dump_ht(Z_ARRVAL_P(zv));
|
||||
fprintf(stderr, "}");
|
||||
} else {
|
||||
zend_dump_const(zv);
|
||||
}
|
||||
}
|
||||
|
||||
static void empty_partial_array(zval *zv)
|
||||
{
|
||||
MAKE_PARTIAL_ARRAY(zv);
|
||||
@@ -139,11 +153,15 @@ static void set_value(scdf_ctx *scdf, sccp_ctx *ctx, int var, zval *new) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (IS_BOT(new)) {
|
||||
SCP_DEBUG("Lowering var %d to BOT\n", var);
|
||||
} else if (!IS_PARTIAL_ARRAY(new) && !IS_PARTIAL_OBJECT(new)) {
|
||||
SCP_DEBUG("Lowering var %d to %Z\n", var, new);
|
||||
}
|
||||
#if SCP_DEBUG
|
||||
fprintf(stderr, "Lowering #%d.", var);
|
||||
zend_dump_var(scdf->op_array, IS_CV, scdf->ssa->vars[var].var);
|
||||
fprintf(stderr, " from");
|
||||
scp_dump_value(value);
|
||||
fprintf(stderr, " to");
|
||||
scp_dump_value(new);
|
||||
fprintf(stderr, "\n");
|
||||
#endif
|
||||
|
||||
if (IS_TOP(value) || IS_BOT(new)) {
|
||||
zval_ptr_dtor_nogc(value);
|
||||
@@ -358,6 +376,31 @@ static zend_bool try_replace_op2(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ct_eval_binary_op(zval *result, zend_uchar binop, zval *op1, zval *op2) {
|
||||
/* TODO: We could implement support for evaluation of + on partial arrays. */
|
||||
if (IS_PARTIAL_ARRAY(op1) || IS_PARTIAL_ARRAY(op2)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
return zend_optimizer_eval_binary_op(result, binop, op1, op2);
|
||||
}
|
||||
|
||||
static inline int ct_eval_bool_cast(zval *result, zval *op) {
|
||||
if (IS_PARTIAL_ARRAY(op)) {
|
||||
if (zend_hash_num_elements(Z_ARRVAL_P(op)) == 0) {
|
||||
/* An empty partial array may be non-empty at runtime, we don't know whether the
|
||||
* result will be true or false. */
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ZVAL_TRUE(result);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
ZVAL_BOOL(result, zend_is_true(op));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static inline int zval_to_string_offset(zend_long *result, zval *op) {
|
||||
switch (Z_TYPE_P(op)) {
|
||||
case IS_LONG:
|
||||
@@ -419,6 +462,23 @@ static inline int ct_eval_fetch_dim(zval *result, zval *op1, zval *op2, int supp
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/* op1 may be NULL here to indicate an unset value */
|
||||
static inline int ct_eval_isset_isempty(zval *result, uint32_t extended_value, zval *op1) {
|
||||
zval zv;
|
||||
if (!(extended_value & ZEND_ISEMPTY)) {
|
||||
ZVAL_BOOL(result, op1 && Z_TYPE_P(op1) != IS_NULL);
|
||||
return SUCCESS;
|
||||
} else if (!op1) {
|
||||
ZVAL_TRUE(result);
|
||||
return SUCCESS;
|
||||
} else if (ct_eval_bool_cast(&zv, op1) == SUCCESS) {
|
||||
ZVAL_BOOL(result, Z_TYPE(zv) == IS_FALSE);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
static inline int ct_eval_isset_dim(zval *result, uint32_t extended_value, zval *op1, zval *op2) {
|
||||
if (Z_TYPE_P(op1) == IS_ARRAY || IS_PARTIAL_ARRAY(op1)) {
|
||||
zval *value;
|
||||
@@ -428,12 +488,7 @@ static inline int ct_eval_isset_dim(zval *result, uint32_t extended_value, zval
|
||||
if (IS_PARTIAL_ARRAY(op1) && (!value || IS_BOT(value))) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (!(extended_value & ZEND_ISEMPTY)) {
|
||||
ZVAL_BOOL(result, value && Z_TYPE_P(value) != IS_NULL);
|
||||
} else {
|
||||
ZVAL_BOOL(result, !value || !zend_is_true(value));
|
||||
}
|
||||
return SUCCESS;
|
||||
return ct_eval_isset_isempty(result, extended_value, value);
|
||||
} else if (Z_TYPE_P(op1) == IS_STRING) {
|
||||
// TODO
|
||||
return FAILURE;
|
||||
@@ -585,12 +640,7 @@ static inline int ct_eval_isset_obj(zval *result, uint32_t extended_value, zval
|
||||
if (!value || IS_BOT(value)) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (!(extended_value & ZEND_ISEMPTY)) {
|
||||
ZVAL_BOOL(result, value && Z_TYPE_P(value) != IS_NULL);
|
||||
} else {
|
||||
ZVAL_BOOL(result, !value || !zend_is_true(value));
|
||||
}
|
||||
return SUCCESS;
|
||||
return ct_eval_isset_isempty(result, extended_value, value);
|
||||
} else {
|
||||
ZVAL_BOOL(result, (extended_value & ZEND_ISEMPTY));
|
||||
return SUCCESS;
|
||||
@@ -650,17 +700,14 @@ static inline int ct_eval_incdec(zval *result, zend_uchar opcode, zval *op1) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static inline int ct_eval_isset_isempty(zval *result, uint32_t extended_value, zval *op1) {
|
||||
if (!(extended_value & ZEND_ISEMPTY)) {
|
||||
ZVAL_BOOL(result, Z_TYPE_P(op1) != IS_NULL);
|
||||
} else {
|
||||
ZVAL_BOOL(result, !zend_is_true(op1));
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static inline void ct_eval_type_check(zval *result, uint32_t type_mask, zval *op1) {
|
||||
ZVAL_BOOL(result, (type_mask >> Z_TYPE_P(op1)) & 1);
|
||||
uint32_t type = Z_TYPE_P(op1);
|
||||
if (type == PARTIAL_ARRAY) {
|
||||
type = IS_ARRAY;
|
||||
} else if (type == PARTIAL_OBJECT) {
|
||||
type = IS_OBJECT;
|
||||
}
|
||||
ZVAL_BOOL(result, (type_mask >> type) & 1);
|
||||
}
|
||||
|
||||
static inline int ct_eval_in_array(zval *result, uint32_t extended_value, zval *op1, zval *op2) {
|
||||
@@ -1238,7 +1285,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
|
||||
/* We want to avoid keeping around intermediate arrays for each SSA variable in the
|
||||
* ADD_ARRAY_ELEMENT chain. We do this by only keeping the array on the last opcode
|
||||
* and use a NULL value everywhere else. */
|
||||
if (Z_TYPE(ctx->values[ssa_op->result_def]) == IS_NULL) {
|
||||
if (result && Z_TYPE_P(result) == IS_NULL) {
|
||||
SET_RESULT_BOT(result);
|
||||
return;
|
||||
}
|
||||
@@ -1359,7 +1406,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
|
||||
SKIP_IF_TOP(op1);
|
||||
SKIP_IF_TOP(op2);
|
||||
|
||||
if (zend_optimizer_eval_binary_op(&zv, opline->opcode, op1, op2) == SUCCESS) {
|
||||
if (ct_eval_binary_op(&zv, opline->opcode, op1, op2) == SUCCESS) {
|
||||
SET_RESULT(result, &zv);
|
||||
zval_ptr_dtor_nogc(&zv);
|
||||
break;
|
||||
@@ -1385,7 +1432,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
|
||||
SKIP_IF_TOP(op2);
|
||||
}
|
||||
if (!opline->extended_value) {
|
||||
if (zend_optimizer_eval_binary_op(&zv, zend_compound_assign_to_binary_op(opline->opcode), op1, op2) == SUCCESS) {
|
||||
if (ct_eval_binary_op(&zv, zend_compound_assign_to_binary_op(opline->opcode), op1, op2) == SUCCESS) {
|
||||
SET_RESULT(op1, &zv);
|
||||
SET_RESULT(result, &zv);
|
||||
zval_ptr_dtor_nogc(&zv);
|
||||
@@ -1412,7 +1459,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
|
||||
break;
|
||||
}
|
||||
|
||||
if (zend_optimizer_eval_binary_op(&tmp, zend_compound_assign_to_binary_op(opline->opcode), &tmp, data) != SUCCESS) {
|
||||
if (ct_eval_binary_op(&tmp, zend_compound_assign_to_binary_op(opline->opcode), &tmp, data) != SUCCESS) {
|
||||
SET_RESULT_BOT(result);
|
||||
SET_RESULT_BOT(op1);
|
||||
zval_ptr_dtor_nogc(&tmp);
|
||||
@@ -1457,7 +1504,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
|
||||
break;
|
||||
}
|
||||
|
||||
if (zend_optimizer_eval_binary_op(&tmp, zend_compound_assign_to_binary_op(opline->opcode), &tmp, data) != SUCCESS) {
|
||||
if (ct_eval_binary_op(&tmp, zend_compound_assign_to_binary_op(opline->opcode), &tmp, data) != SUCCESS) {
|
||||
SET_RESULT_BOT(result);
|
||||
SET_RESULT_BOT(op1);
|
||||
zval_ptr_dtor_nogc(&tmp);
|
||||
@@ -1540,6 +1587,10 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
|
||||
case ZEND_BW_NOT:
|
||||
case ZEND_BOOL_NOT:
|
||||
SKIP_IF_TOP(op1);
|
||||
if (IS_PARTIAL_ARRAY(op1)) {
|
||||
SET_RESULT_BOT(result);
|
||||
break;
|
||||
}
|
||||
if (zend_optimizer_eval_unary_op(&zv, opline->opcode, op1) == SUCCESS) {
|
||||
SET_RESULT(result, &zv);
|
||||
zval_ptr_dtor_nogc(&zv);
|
||||
@@ -1549,6 +1600,10 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
|
||||
break;
|
||||
case ZEND_CAST:
|
||||
SKIP_IF_TOP(op1);
|
||||
if (IS_PARTIAL_ARRAY(op1)) {
|
||||
SET_RESULT_BOT(result);
|
||||
break;
|
||||
}
|
||||
if (zend_optimizer_eval_cast(&zv, opline->extended_value, op1) == SUCCESS) {
|
||||
SET_RESULT(result, &zv);
|
||||
zval_ptr_dtor_nogc(&zv);
|
||||
@@ -1560,8 +1615,12 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
|
||||
case ZEND_JMPZ_EX:
|
||||
case ZEND_JMPNZ_EX:
|
||||
SKIP_IF_TOP(op1);
|
||||
ZVAL_BOOL(&zv, zend_is_true(op1));
|
||||
SET_RESULT(result, &zv);
|
||||
if (ct_eval_bool_cast(&zv, op1) == SUCCESS) {
|
||||
SET_RESULT(result, &zv);
|
||||
zval_ptr_dtor_nogc(&zv);
|
||||
break;
|
||||
}
|
||||
SET_RESULT_BOT(result);
|
||||
break;
|
||||
case ZEND_STRLEN:
|
||||
SKIP_IF_TOP(op1);
|
||||
@@ -1679,6 +1738,10 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
|
||||
break;
|
||||
case ZEND_ROPE_INIT:
|
||||
SKIP_IF_TOP(op2);
|
||||
if (IS_PARTIAL_ARRAY(op2)) {
|
||||
SET_RESULT_BOT(result);
|
||||
break;
|
||||
}
|
||||
if (zend_optimizer_eval_cast(&zv, IS_STRING, op2) == SUCCESS) {
|
||||
SET_RESULT(result, &zv);
|
||||
zval_ptr_dtor_nogc(&zv);
|
||||
@@ -1693,7 +1756,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
|
||||
// string for all SSA vars with some extra checks
|
||||
SKIP_IF_TOP(op1);
|
||||
SKIP_IF_TOP(op2);
|
||||
if (zend_optimizer_eval_binary_op(&zv, ZEND_CONCAT, op1, op2) == SUCCESS) {
|
||||
if (ct_eval_binary_op(&zv, ZEND_CONCAT, op1, op2) == SUCCESS) {
|
||||
SET_RESULT(result, &zv);
|
||||
zval_ptr_dtor_nogc(&zv);
|
||||
break;
|
||||
@@ -1735,7 +1798,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
|
||||
args[i] = get_op1_value(ctx, opline,
|
||||
&ctx->scdf.ssa->ops[opline - ctx->scdf.op_array->opcodes]);
|
||||
if (args[i]) {
|
||||
if (IS_BOT(args[i])) {
|
||||
if (IS_BOT(args[i]) || IS_PARTIAL_ARRAY(args[i])) {
|
||||
SET_RESULT_BOT(result);
|
||||
return;
|
||||
} else if (IS_TOP(args[i])) {
|
||||
@@ -1785,7 +1848,7 @@ static void sccp_mark_feasible_successors(
|
||||
int block_num, zend_basic_block *block,
|
||||
zend_op *opline, zend_ssa_op *ssa_op) {
|
||||
sccp_ctx *ctx = (sccp_ctx *) scdf;
|
||||
zval *op1;
|
||||
zval *op1, zv;
|
||||
int s;
|
||||
|
||||
/* We can't determine the branch target at compile-time for these */
|
||||
@@ -1820,19 +1883,36 @@ static void sccp_mark_feasible_successors(
|
||||
case ZEND_JMPZ:
|
||||
case ZEND_JMPZNZ:
|
||||
case ZEND_JMPZ_EX:
|
||||
s = zend_is_true(op1);
|
||||
{
|
||||
if (ct_eval_bool_cast(&zv, op1) == FAILURE) {
|
||||
scdf_mark_edge_feasible(scdf, block_num, block->successors[0]);
|
||||
scdf_mark_edge_feasible(scdf, block_num, block->successors[1]);
|
||||
return;
|
||||
}
|
||||
s = Z_TYPE(zv) == IS_TRUE;
|
||||
break;
|
||||
}
|
||||
case ZEND_JMPNZ:
|
||||
case ZEND_JMPNZ_EX:
|
||||
case ZEND_JMP_SET:
|
||||
s = !zend_is_true(op1);
|
||||
{
|
||||
if (ct_eval_bool_cast(&zv, op1) == FAILURE) {
|
||||
scdf_mark_edge_feasible(scdf, block_num, block->successors[0]);
|
||||
scdf_mark_edge_feasible(scdf, block_num, block->successors[1]);
|
||||
return;
|
||||
}
|
||||
s = Z_TYPE(zv) == IS_FALSE;
|
||||
break;
|
||||
}
|
||||
case ZEND_COALESCE:
|
||||
s = (Z_TYPE_P(op1) == IS_NULL);
|
||||
break;
|
||||
case ZEND_FE_RESET_R:
|
||||
case ZEND_FE_RESET_RW:
|
||||
if (Z_TYPE_P(op1) != IS_ARRAY && !IS_PARTIAL_ARRAY(op1)) {
|
||||
/* A non-empty partial array is definitely non-empty, but an
|
||||
* empty partial array may be non-empty at runtime. */
|
||||
if (Z_TYPE_P(op1) != IS_ARRAY ||
|
||||
(IS_PARTIAL_ARRAY(op1) && zend_hash_num_elements(Z_ARR_P(op1)) == 0)) {
|
||||
scdf_mark_edge_feasible(scdf, block_num, block->successors[0]);
|
||||
scdf_mark_edge_feasible(scdf, block_num, block->successors[1]);
|
||||
return;
|
||||
@@ -1947,7 +2027,9 @@ static void sccp_visit_phi(scdf_ctx *scdf, zend_ssa_phi *phi) {
|
||||
int i;
|
||||
zval result;
|
||||
MAKE_TOP(&result);
|
||||
SCP_DEBUG("Handling PHI(");
|
||||
#if SCP_DEBUG
|
||||
fprintf(stderr, "Handling phi(");
|
||||
#endif
|
||||
if (phi->pi >= 0) {
|
||||
ZEND_ASSERT(phi->sources[0] >= 0);
|
||||
if (scdf_is_edge_feasible(scdf, phi->pi, phi->block)) {
|
||||
@@ -1957,14 +2039,21 @@ static void sccp_visit_phi(scdf_ctx *scdf, zend_ssa_phi *phi) {
|
||||
for (i = 0; i < block->predecessors_count; i++) {
|
||||
ZEND_ASSERT(phi->sources[i] >= 0);
|
||||
if (scdf_is_edge_feasible(scdf, predecessors[i], phi->block)) {
|
||||
SCP_DEBUG("val, ");
|
||||
#if SCP_DEBUG
|
||||
scp_dump_value(&ctx->values[phi->sources[i]]);
|
||||
fprintf(stderr, ",");
|
||||
#endif
|
||||
join_phi_values(&result, &ctx->values[phi->sources[i]], ssa->vars[phi->ssa_var].escape_state != ESCAPE_STATE_NO_ESCAPE);
|
||||
} else {
|
||||
SCP_DEBUG("--, ");
|
||||
#if SCP_DEBUG
|
||||
fprintf(stderr, " --,");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
SCP_DEBUG(")\n");
|
||||
#if SCP_DEBUG
|
||||
fprintf(stderr, ")\n");
|
||||
#endif
|
||||
|
||||
set_value(scdf, ctx, phi->ssa_var, &result);
|
||||
zval_ptr_dtor_nogc(&result);
|
||||
@@ -2114,6 +2203,14 @@ static int try_remove_definition(sccp_ctx *ctx, int var_num, zend_ssa_var *var,
|
||||
zend_ssa_remove_result_def(ssa, ssa_op);
|
||||
if (opline->opcode == ZEND_DO_ICALL) {
|
||||
removed_ops = remove_call(ctx, opline, ssa_op);
|
||||
} else if (opline->opcode == ZEND_TYPE_CHECK
|
||||
&& !value_known(&ctx->values[ssa_op->op1_use])) {
|
||||
/* For TYPE_CHECK we may compute the result value without knowing the
|
||||
* operand, based on type inference information. Make sure the operand is
|
||||
* freed and leave further cleanup to DCE. */
|
||||
opline->opcode = ZEND_FREE;
|
||||
opline->result_type = IS_UNUSED;
|
||||
removed_ops++;
|
||||
} else {
|
||||
zend_ssa_remove_instr(ssa, opline, ssa_op);
|
||||
removed_ops++;
|
||||
@@ -2372,18 +2469,8 @@ int sccp_optimize_op_array(zend_optimizer_ctx *ctx, zend_op_array *op_array, zen
|
||||
}
|
||||
fprintf(stderr, " #%d.", i);
|
||||
zend_dump_var(op_array, IS_CV, ssa->vars[i].var);
|
||||
if (Z_TYPE_P(zv) == IS_ARRAY || IS_PARTIAL_ARRAY(zv)) {
|
||||
fprintf(stderr, " = %s[", IS_PARTIAL_ARRAY(zv) ? "partial " : "");
|
||||
zend_dump_ht(Z_ARRVAL_P(zv));
|
||||
fprintf(stderr, "]");
|
||||
} else if (IS_PARTIAL_OBJECT(zv)) {
|
||||
fprintf(stderr, " = {");
|
||||
zend_dump_ht(Z_ARRVAL_P(zv));
|
||||
fprintf(stderr, "}");
|
||||
} else {
|
||||
fprintf(stderr, " =");
|
||||
zend_dump_const(zv);
|
||||
}
|
||||
fprintf(stderr, " =");
|
||||
scp_dump_value(zv);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ static void zend_dump_unused_op(const zend_op *opline, znode_op op, uint32_t fla
|
||||
zend_dump_class_fetch_type(op.num);
|
||||
} else if (ZEND_VM_OP_CONSTRUCTOR == (flags & ZEND_VM_OP_MASK)) {
|
||||
fprintf(stderr, " CONSTRUCTOR");
|
||||
} else if (ZEND_VM_OP_CONST_FETCH == (flags & ZEND_VM_EXT_MASK)) {
|
||||
} else if (ZEND_VM_OP_CONST_FETCH == (flags & ZEND_VM_OP_MASK)) {
|
||||
if (op.num & IS_CONSTANT_UNQUALIFIED) {
|
||||
fprintf(stderr, " (unqualified)");
|
||||
}
|
||||
|
||||
@@ -1688,8 +1688,9 @@ int zend_func_info_rid = -1;
|
||||
uint32_t zend_get_func_info(const zend_call_info *call_info, const zend_ssa *ssa)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
const zend_function *callee_func = call_info->callee_func;
|
||||
|
||||
if (call_info->callee_func->type == ZEND_INTERNAL_FUNCTION) {
|
||||
if (callee_func->type == ZEND_INTERNAL_FUNCTION) {
|
||||
zval *zv;
|
||||
func_info_t *info;
|
||||
|
||||
@@ -1700,9 +1701,10 @@ uint32_t zend_get_func_info(const zend_call_info *call_info, const zend_ssa *ssa
|
||||
ret = MAY_BE_NULL;
|
||||
} else if (info->info_func) {
|
||||
ret = info->info_func(call_info, ssa);
|
||||
} else if (/*call_info->callee_func->common.arg_info && */
|
||||
call_info->callee_func->common.num_args == 0 &&
|
||||
call_info->callee_func->common.required_num_args == 0) {
|
||||
} else if (/*callee_func->common.arg_info && */
|
||||
callee_func->common.num_args == 0 &&
|
||||
callee_func->common.required_num_args == 0 &&
|
||||
!(callee_func->common.fn_flags & ZEND_ACC_VARIADIC)) {
|
||||
if (call_info->num_args == 0) {
|
||||
ret = info->info;
|
||||
} else {
|
||||
@@ -1718,19 +1720,19 @@ uint32_t zend_get_func_info(const zend_call_info *call_info, const zend_ssa *ssa
|
||||
}
|
||||
} else {
|
||||
// FIXME: the order of functions matters!!!
|
||||
zend_func_info *info = ZEND_FUNC_INFO((zend_op_array*)call_info->callee_func);
|
||||
zend_func_info *info = ZEND_FUNC_INFO((zend_op_array*)callee_func);
|
||||
if (info) {
|
||||
ret = info->return_info.type;
|
||||
}
|
||||
}
|
||||
if (!ret) {
|
||||
ret = MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
|
||||
if (call_info->callee_func->type == ZEND_INTERNAL_FUNCTION) {
|
||||
if (callee_func->type == ZEND_INTERNAL_FUNCTION) {
|
||||
ret |= FUNC_MAY_WARN;
|
||||
}
|
||||
if (call_info->callee_func->common.fn_flags & ZEND_ACC_GENERATOR) {
|
||||
if (callee_func->common.fn_flags & ZEND_ACC_GENERATOR) {
|
||||
ret = MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_OBJECT;
|
||||
} else if (call_info->callee_func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) {
|
||||
} else if (callee_func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) {
|
||||
ret |= MAY_BE_REF;
|
||||
} else {
|
||||
ret |= MAY_BE_RC1 | MAY_BE_RCN;
|
||||
|
||||
@@ -2895,8 +2895,10 @@ static int zend_update_type_info(const zend_op_array *op_array,
|
||||
tmp = t1;
|
||||
if (t1 & MAY_BE_ARRAY) {
|
||||
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
|
||||
/* SEND_UNPACK may acquire references into the array */
|
||||
tmp |= MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
|
||||
if (t1 & MAY_BE_ARRAY_OF_ANY) {
|
||||
/* SEND_UNPACK may acquire references into the array */
|
||||
tmp |= MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
|
||||
}
|
||||
}
|
||||
if (t1 & MAY_BE_OBJECT) {
|
||||
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
|
||||
|
||||
@@ -431,7 +431,7 @@ static zend_always_inline zend_string *accel_find_interned_string(zend_string *s
|
||||
}
|
||||
|
||||
if (!ZCG(counted)) {
|
||||
if (accel_activate_add() == FAILURE) {
|
||||
if (!ZCG(accelerator_enabled) || accel_activate_add() == FAILURE) {
|
||||
return str;
|
||||
}
|
||||
ZCG(counted) = 1;
|
||||
@@ -572,10 +572,7 @@ static void accel_copy_permanent_strings(zend_new_interned_string_func_t new_int
|
||||
/* empty string */
|
||||
zend_empty_string = new_interned_string(zend_empty_string);
|
||||
for (j = 0; j < 256; j++) {
|
||||
char s[2];
|
||||
s[0] = j;
|
||||
s[1] = 0;
|
||||
zend_one_char_string[j] = new_interned_string(zend_string_init(s, 1, 0));
|
||||
zend_one_char_string[j] = new_interned_string(ZSTR_CHAR(j));
|
||||
}
|
||||
for (j = 0; j < ZEND_STR_LAST_KNOWN; j++) {
|
||||
zend_known_strings[j] = new_interned_string(zend_known_strings[j]);
|
||||
@@ -739,12 +736,11 @@ static zend_string* ZEND_FASTCALL accel_replace_string_by_shm_permanent(zend_str
|
||||
static zend_string* ZEND_FASTCALL accel_replace_string_by_process_permanent(zend_string *str)
|
||||
{
|
||||
zend_string *ret = zend_interned_string_find_permanent(str);
|
||||
|
||||
if (ret) {
|
||||
zend_string_release(str);
|
||||
return ret;
|
||||
}
|
||||
ZEND_ASSERT(0);
|
||||
ZEND_ASSERT(!IS_ACCEL_INTERNED(str));
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -1168,7 +1164,7 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
|
||||
cwd_len = ZSTR_LEN(cwd_str);
|
||||
if (ZCG(cwd_check)) {
|
||||
ZCG(cwd_check) = 0;
|
||||
if ((ZCG(counted) || ZCSG(accelerator_enabled))) {
|
||||
if (ZCG(accelerator_enabled)) {
|
||||
|
||||
zend_string *str = accel_find_interned_string(cwd_str);
|
||||
if (!str) {
|
||||
@@ -1208,7 +1204,7 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
|
||||
|
||||
if (ZCG(include_path_check)) {
|
||||
ZCG(include_path_check) = 0;
|
||||
if ((ZCG(counted) || ZCSG(accelerator_enabled))) {
|
||||
if (ZCG(accelerator_enabled)) {
|
||||
|
||||
zend_string *str = accel_find_interned_string(ZCG(include_path));
|
||||
if (!str) {
|
||||
@@ -1291,7 +1287,7 @@ int zend_accel_invalidate(const char *filename, size_t filename_len, zend_bool f
|
||||
zend_string *realpath;
|
||||
zend_persistent_script *persistent_script;
|
||||
|
||||
if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled) || accelerator_shm_read_lock() != SUCCESS) {
|
||||
if (!ZCG(accelerator_enabled) || accelerator_shm_read_lock() != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@@ -1387,6 +1383,10 @@ static zend_persistent_script *store_script_in_file_cache(zend_persistent_script
|
||||
/* Align to 64-byte boundary */
|
||||
ZCG(mem) = zend_arena_alloc(&CG(arena), memory_used + 64);
|
||||
ZCG(mem) = (void*)(((zend_uintptr_t)ZCG(mem) + 63L) & ~63L);
|
||||
#elif ZEND_MM_ALIGNMENT < 8
|
||||
/* Align to 8-byte boundary */
|
||||
ZCG(mem) = zend_arena_alloc(&CG(arena), memory_used + 8);
|
||||
ZCG(mem) = (void*)(((zend_uintptr_t)ZCG(mem) + 7L) & ~7L);
|
||||
#else
|
||||
ZCG(mem) = zend_arena_alloc(&CG(arena), memory_used);
|
||||
#endif
|
||||
@@ -1914,7 +1914,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
|
||||
} else if (file_cache_only) {
|
||||
return file_cache_compile_file(file_handle, type);
|
||||
#endif
|
||||
} else if ((!ZCG(counted) && !ZCSG(accelerator_enabled)) ||
|
||||
} else if (!ZCG(accelerator_enabled) ||
|
||||
(ZCSG(restart_in_progress) && accel_restart_is_active())) {
|
||||
#ifdef HAVE_OPCACHE_FILE_CACHE
|
||||
if (ZCG(accel_directives).file_cache) {
|
||||
@@ -2209,12 +2209,11 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl
|
||||
/* zend_resolve_path() replacement for PHP 5.3 and above */
|
||||
static zend_string* persistent_zend_resolve_path(const char *filename, size_t filename_len)
|
||||
{
|
||||
if (ZCG(enabled) && accel_startup_ok &&
|
||||
if (
|
||||
#ifdef HAVE_OPCACHE_FILE_CACHE
|
||||
!file_cache_only &&
|
||||
#endif
|
||||
(ZCG(counted) || ZCSG(accelerator_enabled)) &&
|
||||
!ZCSG(restart_in_progress)) {
|
||||
ZCG(accelerator_enabled)) {
|
||||
|
||||
/* check if callback is called from include_once or it's a main request */
|
||||
if ((!EG(current_execute_data) &&
|
||||
@@ -2315,8 +2314,6 @@ static void accel_reset_pcre_cache(void)
|
||||
|
||||
static void accel_activate(void)
|
||||
{
|
||||
zend_bool reset_pcre = 0;
|
||||
|
||||
if (!ZCG(enabled) || !accel_startup_ok) {
|
||||
return;
|
||||
}
|
||||
@@ -2363,6 +2360,7 @@ static void accel_activate(void)
|
||||
zend_alter_ini_entry_chars(key, "0", 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_RUNTIME);
|
||||
zend_string_release_ex(key, 0);
|
||||
zend_accel_error(ACCEL_LOG_WARNING, "Can't cache files in chroot() directory with too big inode");
|
||||
ZCG(accelerator_enabled) = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2420,16 +2418,16 @@ static void accel_activate(void)
|
||||
}
|
||||
accel_restart_leave();
|
||||
}
|
||||
} else {
|
||||
reset_pcre = 1;
|
||||
}
|
||||
zend_shared_alloc_unlock();
|
||||
}
|
||||
|
||||
ZCG(accelerator_enabled) = ZCSG(accelerator_enabled);
|
||||
|
||||
SHM_PROTECT();
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
|
||||
if (ZCSG(last_restart_time) != ZCG(last_restart_time)) {
|
||||
if (ZCG(accelerator_enabled) && ZCSG(last_restart_time) != ZCG(last_restart_time)) {
|
||||
/* SHM was reinitialized. */
|
||||
ZCG(last_restart_time) = ZCSG(last_restart_time);
|
||||
|
||||
@@ -2437,8 +2435,10 @@ static void accel_activate(void)
|
||||
realpath_cache_clean();
|
||||
|
||||
accel_reset_pcre_cache();
|
||||
} else if (reset_pcre) {
|
||||
ZCG(pcre_reseted) = 0;
|
||||
} else if (!ZCG(accelerator_enabled) && !ZCG(pcre_reseted)) {
|
||||
accel_reset_pcre_cache();
|
||||
ZCG(pcre_reseted) = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2466,10 +2466,6 @@ static void accel_deactivate(void)
|
||||
zend_string_release_ex(ZCG(cwd), 0);
|
||||
ZCG(cwd) = NULL;
|
||||
}
|
||||
|
||||
if (!ZCG(enabled) || !accel_startup_ok) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static int accelerator_remove_cb(zend_extension *element1, zend_extension *element2)
|
||||
@@ -2511,6 +2507,7 @@ static inline int accel_find_sapi(void)
|
||||
"cli-server",
|
||||
"cgi-fcgi",
|
||||
"fpm-fcgi",
|
||||
"fpmi-fcgi",
|
||||
"apache2handler",
|
||||
"litespeed",
|
||||
"uwsgi",
|
||||
|
||||
@@ -195,6 +195,8 @@ typedef struct _zend_accel_globals {
|
||||
int counted; /* the process uses shared memory */
|
||||
zend_bool enabled;
|
||||
zend_bool locked; /* thread obtained exclusive lock */
|
||||
zend_bool accelerator_enabled; /* accelerator enabled for current request */
|
||||
zend_bool pcre_reseted;
|
||||
HashTable bind_hash; /* prototype and zval lookup table */
|
||||
zend_accel_directives accel_directives;
|
||||
zend_string *cwd; /* current working directory or NULL */
|
||||
|
||||
@@ -4,6 +4,7 @@ Bug #66461 (PHP crashes if opcache.interned_strings_buffer=0)
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
opcache.log_verbosity_level=1
|
||||
opcache.file_update_protection=0
|
||||
opcache.interned_strings_buffer=0
|
||||
--SKIPIF--
|
||||
|
||||
@@ -3,7 +3,7 @@ Bug #71443 (Segfault using built-in webserver with intl using symfony)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_cache=/tmp/
|
||||
opcache.file_cache={TMP}
|
||||
opcache.file_cache_only=1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
|
||||
@@ -3,7 +3,7 @@ Bug #76275: Assertion failure in file cache when unserializing empty try_catch_a
|
||||
--INI--
|
||||
opcache.enabled=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_cache=/tmp
|
||||
opcache.file_cache={TMP}
|
||||
--FILE--
|
||||
<?php
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
--TEST--
|
||||
Bug #78015: Incorrect evaluation of expressions involving partials array in SCCP
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$x = 1;
|
||||
|
||||
function test1() {
|
||||
global $x;
|
||||
$a = ['b' => [$x], 'c' => [$x]];
|
||||
$d = $a['b'] + $a['c'];
|
||||
return $d;
|
||||
}
|
||||
|
||||
function test2() {
|
||||
global $x;
|
||||
$a = ['b' => [$x]];
|
||||
$d = !$a['b'];
|
||||
return $d;
|
||||
}
|
||||
|
||||
function test3() {
|
||||
global $x;
|
||||
$a = ['b' => [$x]];
|
||||
$d = (int) $a['b'];
|
||||
return $d;
|
||||
}
|
||||
|
||||
function test4() {
|
||||
global $x;
|
||||
$a = ['b' => [$x]];
|
||||
$d = $a['b'] ?: 42;
|
||||
return $d;
|
||||
}
|
||||
|
||||
function test5() {
|
||||
global $x;
|
||||
$a = ['b' => [$x]];
|
||||
$d = is_array($a['b']);
|
||||
return $d;
|
||||
}
|
||||
|
||||
function test6() {
|
||||
global $x;
|
||||
$a = ['b' => [$x]];
|
||||
$b = "foo";
|
||||
$d = "$a[b]{$b}bar";
|
||||
return $d;
|
||||
}
|
||||
|
||||
function test7() {
|
||||
global $x;
|
||||
$a = ['b' => [$x]];
|
||||
$y = 1;
|
||||
foreach ($a['b'] as $_) {
|
||||
$y = 2;
|
||||
}
|
||||
return $y;
|
||||
}
|
||||
|
||||
function test8($array) {
|
||||
$i = 0;
|
||||
$ret = [[]];
|
||||
foreach ($array as $_) {
|
||||
$i++;
|
||||
$ret = [[
|
||||
'x' => 0,
|
||||
'y' => $i,
|
||||
]];
|
||||
}
|
||||
return $ret[0];
|
||||
}
|
||||
|
||||
function test9() {
|
||||
global $x;
|
||||
$a = ['b' => [$x]];
|
||||
return serialize($a['b']);
|
||||
}
|
||||
|
||||
var_dump(test1());
|
||||
var_dump(test2());
|
||||
var_dump(test3());
|
||||
var_dump(test4());
|
||||
var_dump(test5());
|
||||
var_dump(test6());
|
||||
var_dump(test7());
|
||||
var_dump(test8([1]));
|
||||
var_dump(test9());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
bool(false)
|
||||
int(1)
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
bool(true)
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
string(11) "Arrayfoobar"
|
||||
int(2)
|
||||
array(2) {
|
||||
["x"]=>
|
||||
int(0)
|
||||
["y"]=>
|
||||
int(1)
|
||||
}
|
||||
string(14) "a:1:{i:0;i:1;}"
|
||||
@@ -8,6 +8,7 @@ The process should die regardless of the log_verbosity_level.
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_cache_only=0
|
||||
opcache.file_cache_fallback=0
|
||||
opcache.memory_consumption=999999999
|
||||
opcache.log_verbosity_level=-1
|
||||
--SKIPIF--
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
SCCP 030: TYPE_CHECK inferred from type inference info
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
opcache.opt_debug_level=0
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(is_string(sys_get_temp_dir()));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Type inference of SEND_UNPACK with empty array
|
||||
--FILE--
|
||||
<?php
|
||||
function test() {
|
||||
$array = [1, 2, 3];
|
||||
$values = [];
|
||||
var_dump(array_push($array, 4, ...$values));
|
||||
var_dump($array);
|
||||
}
|
||||
test();
|
||||
?>
|
||||
--EXPECT--
|
||||
int(4)
|
||||
array(4) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
}
|
||||
@@ -7,6 +7,7 @@ outputs the correct logging at the highest log_verbosity_level
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_cache_only=0
|
||||
opcache.error_log=
|
||||
opcache.log_verbosity_level=4
|
||||
opcache.huge_code_pages=0
|
||||
--SKIPIF--
|
||||
|
||||
@@ -438,11 +438,11 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
|
||||
{
|
||||
php_info_print_table_start();
|
||||
|
||||
if (ZCG(enabled) && accel_startup_ok &&
|
||||
if (
|
||||
#ifdef HAVE_OPCACHE_FILE_CACHE
|
||||
((ZCG(counted) || ZCSG(accelerator_enabled)) || file_cache_only)
|
||||
(ZCG(accelerator_enabled) || file_cache_only)
|
||||
#else
|
||||
(ZCG(counted) || ZCSG(accelerator_enabled))
|
||||
(ZCG(accelerator_enabled))
|
||||
#endif
|
||||
) {
|
||||
php_info_print_table_row(2, "Opcode Caching", "Up and Running");
|
||||
@@ -546,7 +546,7 @@ static int accelerator_get_scripts(zval *return_value)
|
||||
struct timeval exec_time;
|
||||
struct timeval fetch_time;
|
||||
|
||||
if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled) || accelerator_shm_read_lock() != SUCCESS) {
|
||||
if (!ZCG(accelerator_enabled) || accelerator_shm_read_lock() != SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ static ZEND_FUNCTION(opcache_get_status)
|
||||
array_init(return_value);
|
||||
|
||||
/* Trivia */
|
||||
add_assoc_bool(return_value, "opcache_enabled", ZCG(enabled) && (ZCG(counted) || ZCSG(accelerator_enabled)));
|
||||
add_assoc_bool(return_value, "opcache_enabled", ZCG(accelerator_enabled));
|
||||
|
||||
#ifdef HAVE_OPCACHE_FILE_CACHE
|
||||
if (ZCG(accel_directives).file_cache) {
|
||||
@@ -766,7 +766,10 @@ static ZEND_FUNCTION(opcache_reset)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* exclusive lock */
|
||||
zend_shared_alloc_lock();
|
||||
zend_accel_schedule_restart(ACCEL_RESTART_USER);
|
||||
zend_shared_alloc_unlock();
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
@@ -805,7 +808,7 @@ static ZEND_FUNCTION(opcache_compile_file)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled)) {
|
||||
if (!ZCG(accelerator_enabled)) {
|
||||
zend_error(E_NOTICE, ACCELERATOR_PRODUCT_NAME " seems to be disabled, can't compile file");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -844,7 +847,7 @@ static ZEND_FUNCTION(opcache_is_script_cached)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled)) {
|
||||
if (!ZCG(accelerator_enabled)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -6496,7 +6496,10 @@ static int php_openssl_cipher_init(const EVP_CIPHER *cipher_type,
|
||||
return FAILURE;
|
||||
}
|
||||
if (mode->is_single_run_aead && enc) {
|
||||
EVP_CIPHER_CTX_ctrl(cipher_ctx, mode->aead_set_tag_flag, tag_len, NULL);
|
||||
if (!EVP_CIPHER_CTX_ctrl(cipher_ctx, mode->aead_set_tag_flag, tag_len, NULL)) {
|
||||
php_error_docref(NULL, E_WARNING, "Setting tag length for AEAD cipher failed");
|
||||
return FAILURE;
|
||||
}
|
||||
} else if (!enc && tag && tag_len > 0) {
|
||||
if (!mode->is_aead) {
|
||||
php_error_docref(NULL, E_WARNING, "The tag cannot be used because the cipher method does not support AEAD");
|
||||
|
||||
@@ -13,7 +13,7 @@ $clientCtx = stream_context_create(['ssl' => [
|
||||
// We can't use http://curl.haxx.se/ca/cacert.pem for this test
|
||||
// as it is redirected to https which means the test would depend
|
||||
// on system cafile when opening stream.
|
||||
'cafile' => 'http://www.php.net',
|
||||
'cafile' => 'http://www.nginx.org',
|
||||
]]);
|
||||
file_get_contents('https://github.com', false, $clientCtx);
|
||||
?>
|
||||
|
||||
@@ -24,9 +24,12 @@ foreach ($tests as $idx => $test) {
|
||||
// Empty IV error
|
||||
var_dump(openssl_encrypt('data', $method, 'password', 0, NULL, $tag, ''));
|
||||
|
||||
// Test setting different IV length and unlimeted tag
|
||||
var_dump(openssl_encrypt('data', $method, 'password', 0, str_repeat('x', 10), $tag, '', 1024));
|
||||
// Test setting different IV length and tag length
|
||||
var_dump(openssl_encrypt('data', $method, 'password', 0, str_repeat('x', 10), $tag, '', 14));
|
||||
var_dump(strlen($tag));
|
||||
|
||||
// Test setting invalid tag length
|
||||
var_dump(openssl_encrypt('data', $method, 'password', 0, str_repeat('x', 16), $tag, '', 1024));
|
||||
?>
|
||||
--EXPECTF--
|
||||
TEST 0
|
||||
@@ -36,4 +39,7 @@ bool(true)
|
||||
Warning: openssl_encrypt(): Setting of IV length for AEAD mode failed in %s on line %d
|
||||
bool(false)
|
||||
string(8) "p/lvgA=="
|
||||
int(1024)
|
||||
int(14)
|
||||
|
||||
Warning: openssl_encrypt(): Setting of IV length for AEAD mode failed in %s on line %d
|
||||
bool(false)
|
||||
@@ -875,6 +875,7 @@ static int php_openssl_enable_peer_verification(SSL_CTX *ctx, php_stream *stream
|
||||
|
||||
if (cafile || capath) {
|
||||
if (!SSL_CTX_load_verify_locations(ctx, cafile, capath)) {
|
||||
ERR_clear_error();
|
||||
if (cafile && !php_openssl_load_stream_cafile(SSL_CTX_get_cert_store(ctx), cafile)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@@ -558,6 +558,10 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
|
||||
mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, parameter, MYSQL_TYPE_LONG);
|
||||
#endif /* SIZEOF_LONG */
|
||||
break;
|
||||
case IS_TRUE:
|
||||
case IS_FALSE:
|
||||
mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, parameter, MYSQL_TYPE_TINY);
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, parameter, MYSQL_TYPE_DOUBLE);
|
||||
break;
|
||||
@@ -874,7 +878,7 @@ static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, zend_long colno, zval *retu
|
||||
case MYSQL_TYPE_SHORT:
|
||||
case MYSQL_TYPE_INT24:
|
||||
case MYSQL_TYPE_LONG:
|
||||
#if SIZEOF_LONG==8
|
||||
#if SIZEOF_ZEND_LONG==8
|
||||
case MYSQL_TYPE_LONGLONG:
|
||||
#endif
|
||||
add_assoc_long(return_value, "pdo_type", PDO_PARAM_INT);
|
||||
|
||||
@@ -0,0 +1,285 @@
|
||||
--TEST--
|
||||
PDO MySQL Bug #38546 (bindParam incorrect processing of bool types)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
|
||||
require dirname(__FILE__) . '/config.inc';
|
||||
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
PDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require dirname(__FILE__) . '/config.inc';
|
||||
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
||||
|
||||
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
|
||||
|
||||
// To test error cases.
|
||||
$db->exec("SET sql_mode='STRICT_TRANS_TABLES'");
|
||||
|
||||
$db->exec("DROP TABLE IF EXISTS test");
|
||||
|
||||
$query = "CREATE TABLE test(
|
||||
uid MEDIUMINT UNSIGNED NOT NULL,
|
||||
some_bool_1 BOOL NOT NULL,
|
||||
some_bool_2 BOOL NOT NULL,
|
||||
some_int TINYINT NOT NULL
|
||||
)";
|
||||
$db->exec($query);
|
||||
|
||||
$st = $db->prepare("INSERT INTO test (uid, some_bool_1, some_bool_2, some_int) VALUES (?, ?, ?, ?)");
|
||||
|
||||
$values = [
|
||||
'uid' => 6,
|
||||
'some_bool_1' => false,
|
||||
'some_bool_2' => true,
|
||||
'some_int' => -23
|
||||
];
|
||||
$st->bindParam(1, $values['uid'], PDO::PARAM_INT);
|
||||
$st->bindParam(2, $values['some_bool_1'], PDO::PARAM_BOOL);
|
||||
$st->bindParam(3, $values['some_bool_2'], PDO::PARAM_BOOL);
|
||||
$st->bindParam(4, $values['some_int'], PDO::PARAM_INT);
|
||||
|
||||
$result = $st->execute();
|
||||
|
||||
if ($result === false) {
|
||||
var_dump($st->errorInfo());
|
||||
} else {
|
||||
print("ok insert\n");
|
||||
}
|
||||
|
||||
foreach ($db->query('SELECT * from test') as $row) {
|
||||
print_r($row);
|
||||
}
|
||||
|
||||
$st = $db->prepare("UPDATE test SET some_bool_1=?, some_bool_2=?, some_int=? WHERE uid=?");
|
||||
|
||||
$values = [
|
||||
'uid' => 6,
|
||||
'some_bool_1' => (bool) 1,
|
||||
'some_bool_2' => (bool) 0,
|
||||
'some_int' => 1,
|
||||
];
|
||||
|
||||
$st->bindParam(1, $values['some_bool_1'], PDO::PARAM_BOOL);
|
||||
$st->bindParam(2, $values['some_bool_2'], PDO::PARAM_BOOL);
|
||||
$st->bindParam(3, $values['some_int'], PDO::PARAM_INT);
|
||||
$st->bindParam(4, $values['uid'], PDO::PARAM_INT);
|
||||
|
||||
$result = $st->execute();
|
||||
|
||||
if ($result === false) {
|
||||
var_dump($st->errorInfo());
|
||||
} else {
|
||||
print("ok prepare 1\n");
|
||||
}
|
||||
|
||||
foreach ($db->query('SELECT * from test') as $row) {
|
||||
print_r($row);
|
||||
}
|
||||
|
||||
$st = $db->prepare("UPDATE test SET some_bool_1=?, some_bool_2=?, some_int=? WHERE uid=?");
|
||||
|
||||
$values = [
|
||||
'uid' => 6,
|
||||
'some_bool_1' => (bool) 0,
|
||||
'some_bool_2' => (bool) 1,
|
||||
'some_int' => 2,
|
||||
];
|
||||
|
||||
$st->bindParam(1, $values['some_bool_1'], PDO::PARAM_BOOL);
|
||||
$st->bindParam(2, $values['some_bool_2'], PDO::PARAM_BOOL);
|
||||
$st->bindParam(3, $values['some_int'], PDO::PARAM_INT);
|
||||
$st->bindParam(4, $values['uid'], PDO::PARAM_INT);
|
||||
|
||||
$result = $st->execute();
|
||||
|
||||
if ($result === false) {
|
||||
var_dump($st->errorInfo());
|
||||
} else {
|
||||
print("ok prepare 2\n");
|
||||
}
|
||||
|
||||
foreach ($db->query('SELECT * from test') as $row) {
|
||||
print_r($row);
|
||||
}
|
||||
|
||||
// String true and false should fail
|
||||
$st = $db->prepare("UPDATE test SET some_bool_1=?, some_bool_2=?, some_int=? WHERE uid=?");
|
||||
|
||||
$values = [
|
||||
'uid' => 6,
|
||||
'some_bool_1' => 'true',
|
||||
'some_bool_2' => 'false',
|
||||
'some_int' => 3,
|
||||
];
|
||||
|
||||
$st->bindParam(1, $values['some_bool_1'], PDO::PARAM_BOOL);
|
||||
$st->bindParam(2, $values['some_bool_2'], PDO::PARAM_BOOL);
|
||||
$st->bindParam(3, $values['some_int'], PDO::PARAM_INT);
|
||||
$st->bindParam(4, $values['uid'], PDO::PARAM_INT);
|
||||
|
||||
$result = $st->execute();
|
||||
|
||||
if ($result === false) {
|
||||
var_dump($st->errorInfo());
|
||||
} else {
|
||||
print("ok prepare 3\n");
|
||||
}
|
||||
|
||||
foreach ($db->query('SELECT * from test') as $row) {
|
||||
print_r($row);
|
||||
}
|
||||
|
||||
// Null should not be treated as false
|
||||
$st = $db->prepare("UPDATE test SET some_bool_1=?, some_bool_2=?, some_int=? WHERE uid=?");
|
||||
|
||||
$values = [
|
||||
'uid' => 6,
|
||||
'some_bool_1' => true,
|
||||
'some_bool_2' => null,
|
||||
'some_int' => 4,
|
||||
];
|
||||
|
||||
$st->bindParam(1, $values['some_bool_1'], PDO::PARAM_BOOL);
|
||||
$st->bindParam(2, $values['some_bool_2'], PDO::PARAM_BOOL);
|
||||
$st->bindParam(3, $values['some_int'], PDO::PARAM_INT);
|
||||
$st->bindParam(4, $values['uid'], PDO::PARAM_INT);
|
||||
|
||||
$result = $st->execute();
|
||||
|
||||
if ($result === false) {
|
||||
var_dump($st->errorInfo());
|
||||
} else {
|
||||
print("ok prepare 4\n");
|
||||
}
|
||||
|
||||
foreach ($db->query('SELECT * from test') as $row) {
|
||||
print_r($row);
|
||||
}
|
||||
|
||||
// Integers converted correctly
|
||||
$st = $db->prepare("UPDATE test SET some_bool_1=?, some_bool_2=?, some_int=? WHERE uid=?");
|
||||
|
||||
$values = [
|
||||
'uid' => 6,
|
||||
'some_bool_1' => 256,
|
||||
'some_bool_2' => 0,
|
||||
'some_int' => 5,
|
||||
];
|
||||
|
||||
$st->bindParam(1, $values['some_bool_1'], PDO::PARAM_BOOL);
|
||||
$st->bindParam(2, $values['some_bool_2'], PDO::PARAM_BOOL);
|
||||
$st->bindParam(3, $values['some_int'], PDO::PARAM_INT);
|
||||
$st->bindParam(4, $values['uid'], PDO::PARAM_INT);
|
||||
|
||||
$result = $st->execute();
|
||||
|
||||
if ($result === false) {
|
||||
var_dump($st->errorInfo());
|
||||
} else {
|
||||
print("ok prepare 5\n");
|
||||
}
|
||||
|
||||
foreach ($db->query('SELECT * from test') as $row) {
|
||||
print_r($row);
|
||||
}
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require dirname(__FILE__) . '/mysql_pdo_test.inc';
|
||||
MySQLPDOTest::dropTestTable();
|
||||
?>
|
||||
--EXPECTF--
|
||||
ok insert
|
||||
Array
|
||||
(
|
||||
[uid] => 6
|
||||
[0] => 6
|
||||
[some_bool_1] => 0
|
||||
[1] => 0
|
||||
[some_bool_2] => 1
|
||||
[2] => 1
|
||||
[some_int] => -23
|
||||
[3] => -23
|
||||
)
|
||||
ok prepare 1
|
||||
Array
|
||||
(
|
||||
[uid] => 6
|
||||
[0] => 6
|
||||
[some_bool_1] => 1
|
||||
[1] => 1
|
||||
[some_bool_2] => 0
|
||||
[2] => 0
|
||||
[some_int] => 1
|
||||
[3] => 1
|
||||
)
|
||||
ok prepare 2
|
||||
Array
|
||||
(
|
||||
[uid] => 6
|
||||
[0] => 6
|
||||
[some_bool_1] => 0
|
||||
[1] => 0
|
||||
[some_bool_2] => 1
|
||||
[2] => 1
|
||||
[some_int] => 2
|
||||
[3] => 2
|
||||
)
|
||||
|
||||
Warning: PDOStatement::execute(): SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'true' for column 'some_bool_1' at row 1 in %s
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(5) "HY000"
|
||||
[1]=>
|
||||
int(1366)
|
||||
[2]=>
|
||||
string(65) "Incorrect integer value: 'true' for column 'some_bool_1' at row 1"
|
||||
}
|
||||
Array
|
||||
(
|
||||
[uid] => 6
|
||||
[0] => 6
|
||||
[some_bool_1] => 0
|
||||
[1] => 0
|
||||
[some_bool_2] => 1
|
||||
[2] => 1
|
||||
[some_int] => 2
|
||||
[3] => 2
|
||||
)
|
||||
|
||||
Warning: PDOStatement::execute(): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'some_bool_2' cannot be null in %s
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(5) "23000"
|
||||
[1]=>
|
||||
int(1048)
|
||||
[2]=>
|
||||
string(35) "Column 'some_bool_2' cannot be null"
|
||||
}
|
||||
Array
|
||||
(
|
||||
[uid] => 6
|
||||
[0] => 6
|
||||
[some_bool_1] => 0
|
||||
[1] => 0
|
||||
[some_bool_2] => 1
|
||||
[2] => 1
|
||||
[some_int] => 2
|
||||
[3] => 2
|
||||
)
|
||||
ok prepare 5
|
||||
Array
|
||||
(
|
||||
[uid] => 6
|
||||
[0] => 6
|
||||
[some_bool_1] => 1
|
||||
[1] => 1
|
||||
[some_bool_2] => 0
|
||||
[2] => 0
|
||||
[some_int] => 5
|
||||
[3] => 5
|
||||
)
|
||||
@@ -37,8 +37,6 @@ function bug_44707($db) {
|
||||
|
||||
$stmt = $db->prepare('INSERT INTO test(id, mybool) VALUES (?, ?)');
|
||||
$stmt->bindParam(1, $id);
|
||||
// From MySQL 4.1 on boolean and TINYINT don't match! INSERT will fail.
|
||||
// Versions prior to 4.1 have a weak test and will accept this.
|
||||
$stmt->bindParam(2, $mybool, PDO::PARAM_BOOL);
|
||||
var_dump($mybool);
|
||||
|
||||
@@ -78,8 +76,6 @@ Native Prepared Statements
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
@@ -89,4 +85,20 @@ array(1) {
|
||||
string(1) "0"
|
||||
}
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
["id"]=>
|
||||
string(1) "1"
|
||||
["mybool"]=>
|
||||
string(1) "0"
|
||||
}
|
||||
[1]=>
|
||||
array(2) {
|
||||
["id"]=>
|
||||
string(1) "1"
|
||||
["mybool"]=>
|
||||
string(1) "0"
|
||||
}
|
||||
}
|
||||
done!
|
||||
@@ -107,7 +107,7 @@ class MySQLPDOTest extends PDOTest {
|
||||
|
||||
// stinky string which we need to parse
|
||||
$parts = explode('.', $version_string);
|
||||
if (count($parts) != 3)
|
||||
if (count($parts) < 3)
|
||||
return -1;
|
||||
|
||||
$version = (int)$parts[0] * 10000;
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
--TEST--
|
||||
MySQL PDO->__construct() - URI
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die('skip only for Windows');
|
||||
}
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
MySQLPDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
|
||||
try {
|
||||
|
||||
if ($tmp = MySQLPDOTest::getTempDir()) {
|
||||
|
||||
$file = $tmp . DIRECTORY_SEPARATOR . 'pdomuri.tst';
|
||||
$dsn = MySQLPDOTest::getDSN();
|
||||
$user = PDO_MYSQL_TEST_USER;
|
||||
$pass = PDO_MYSQL_TEST_PASS;
|
||||
$uri = sprintf('uri:file:%s', $file);
|
||||
|
||||
if ($fp = @fopen($file, 'w')) {
|
||||
// ok, great we can create a file with a DSN in it
|
||||
fwrite($fp, $dsn);
|
||||
fclose($fp);
|
||||
clearstatcache();
|
||||
assert(file_exists($file));
|
||||
try {
|
||||
$db = new PDO($uri, $user, $pass);
|
||||
} catch (PDOException $e) {
|
||||
printf("[002] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), %s\n",
|
||||
$uri, $dsn,
|
||||
$file, filesize($file), file_get_contents($file),
|
||||
$e->getMessage());
|
||||
}
|
||||
unlink($file);
|
||||
}
|
||||
|
||||
if ($fp = @fopen($file, 'w')) {
|
||||
fwrite($fp, sprintf('mysql:dbname=letshopeinvalid;%s%s',
|
||||
chr(0), $dsn));
|
||||
fclose($fp);
|
||||
clearstatcache();
|
||||
assert(file_exists($file));
|
||||
try {
|
||||
$db = new PDO($uri, $user, $pass);
|
||||
} catch (PDOException $e) {
|
||||
printf("[003] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), chr(0) test, %s\n",
|
||||
$uri, $dsn,
|
||||
$file, filesize($file), file_get_contents($file),
|
||||
$e->getMessage());
|
||||
}
|
||||
unlink($file);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* TODO: safe mode */
|
||||
|
||||
} catch (PDOException $e) {
|
||||
printf("[001] %s, [%s] %s\n",
|
||||
$e->getMessage(),
|
||||
(is_object($db)) ? $db->errorCode() : 'n/a',
|
||||
(is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
|
||||
}
|
||||
|
||||
print "done!";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: PDO::__construct(file:%spdomuri.tst): failed to open stream: Invalid argument in %s on line %d
|
||||
[002] URI=uri:file:%spdomuri.tst, DSN=mysql%sdbname=%s, File=%spdomuri.tst (%d bytes, 'mysql%sdbname=%s'), invalid data source URI
|
||||
|
||||
Warning: PDO::__construct(file:%spdomuri.tst): failed to open stream: Invalid argument in %s on line %d
|
||||
[003] URI=uri:file:%spdomuri.tst, DSN=mysql%sdbname=%s, File=%spdomuri.tst (%d bytes, 'mysql%sdbname=letshopeinvalid%s'), chr(0) test, invalid data source URI
|
||||
done!
|
||||
@@ -2,9 +2,6 @@
|
||||
MySQL PDO->__construct() - URI
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip not for Windows');
|
||||
}
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
MySQLPDOTest::skip();
|
||||
@@ -21,7 +18,7 @@ MySQLPDOTest::skip();
|
||||
$dsn = MySQLPDOTest::getDSN();
|
||||
$user = PDO_MYSQL_TEST_USER;
|
||||
$pass = PDO_MYSQL_TEST_PASS;
|
||||
$uri = sprintf('uri:file:%s', $file);
|
||||
$uri = sprintf('uri:file://%s', (substr(PHP_OS, 0, 3) == 'WIN' ? str_replace('\\', '/', $file) : $file));
|
||||
|
||||
if ($fp = @fopen($file, 'w')) {
|
||||
// ok, great we can create a file with a DSN in it
|
||||
@@ -49,10 +46,14 @@ MySQLPDOTest::skip();
|
||||
try {
|
||||
$db = new PDO($uri, $user, $pass);
|
||||
} catch (PDOException $e) {
|
||||
$expected = array(
|
||||
"SQLSTATE[HY000] [1049] Unknown database 'letshopeinvalid'",
|
||||
"SQLSTATE[HY000] [2002] No such file or directory"
|
||||
);
|
||||
printf("[003] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), chr(0) test, %s\n",
|
||||
$uri, $dsn,
|
||||
$file, filesize($file), file_get_contents($file),
|
||||
$e->getMessage());
|
||||
(in_array($e->getMessage(), $expected) ? 'EXPECTED ERROR' : $e->getMessage()));
|
||||
}
|
||||
unlink($file);
|
||||
}
|
||||
@@ -71,9 +72,5 @@ MySQLPDOTest::skip();
|
||||
print "done!";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: PDO::__construct(file:/tmp/pdomuri.tst): failed to open stream: No such file or directory in %s on line %d
|
||||
[002] URI=uri:file:%spdomuri.tst, DSN=mysql%sdbname=%s, File=%spdomuri.tst (%d bytes, 'mysql%sdbname=%s'), invalid data source URI
|
||||
|
||||
Warning: PDO::__construct(file:/tmp/pdomuri.tst): failed to open stream: No such file or directory in %s on line %d
|
||||
[003] URI=uri:file:%spdomuri.tst, DSN=mysql%sdbname=%s, File=%spdomuri.tst (%d bytes, 'mysql%sdbname=letshopeinvalid%s'), chr(0) test, invalid data source URI
|
||||
[003] URI=uri:file://%spdomuri.tst, DSN=mysql%sdbname=%s, File=%spdomuri.tst (%d bytes, 'mysql%sdbname=letshopeinvalid%s'), chr(0) test, EXPECTED ERROR
|
||||
done!
|
||||
@@ -75,7 +75,7 @@ MySQLPDOTest::skip();
|
||||
exec_and_count(19, $db, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(255)) BEGIN SELECT VERSION() INTO ver_param; END;', 0);
|
||||
// we got this far without problems. If there's an issue from now on, its a failure
|
||||
$ignore_exception = false;
|
||||
exec_and_count(20, $db, 'CALL p(@version)', 0);
|
||||
exec_and_count(20, $db, 'CALL p(@version)', 1);
|
||||
$stmt = $db->query('SELECT @version AS p_version');
|
||||
$tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
if (count($tmp) > 1 || !isset($tmp[0]['p_version'])) {
|
||||
|
||||
@@ -26,5 +26,5 @@ __HALT_COMPILER();
|
||||
?>
|
||||
--EXPECTF--
|
||||
%s(24) "UnexpectedValueException"
|
||||
RecursiveDirectoryIterator::__construct(1,1): The system cannot find the file specified. (code: 2)
|
||||
RecursiveDirectoryIterator::__construct(1,1): %s (code: 2)
|
||||
===DONE===
|
||||
@@ -42,7 +42,7 @@ bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
Warning: opendir(foo/hi,foo/hi): The system cannot find the path specified. (code: 3) in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
|
||||
Warning: opendir(foo/hi,foo/hi): %s (code: 3) in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
|
||||
|
||||
Warning: opendir(foo/hi): failed to open dir: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
|
||||
===DONE===
|
||||
@@ -7,23 +7,14 @@ Francesco Fullone ff@ideato.it
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
|
||||
if(!extension_loaded("pcntl")) print "skip - PCNTL extension required";
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
echo "*** Test by calling function with pid error ***\n";
|
||||
|
||||
$pid = 10000;
|
||||
posix_kill((2 ** 22) + 1, SIGKILL);
|
||||
|
||||
do {
|
||||
$pid += 1;
|
||||
$result = shell_exec("ps -p " . $pid);
|
||||
} while (strstr($pid, $result));
|
||||
|
||||
posix_kill($pid, SIGKILL);
|
||||
var_dump(posix_errno());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
*** Test by calling function with pid error ***
|
||||
|
||||
@@ -3,7 +3,7 @@ Bug #69054 (Null dereference in readline_(read|write)_history() without paramete
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("readline") || !function_exists('readline_add_history')) die("skip"); ?>
|
||||
--INI--
|
||||
open_basedir=/tmp
|
||||
open_basedir={TMP}
|
||||
--FILE--
|
||||
<?php readline_read_history(); ?>
|
||||
==DONE==
|
||||
|
||||
@@ -4150,21 +4150,10 @@ ZEND_METHOD(reflection_class, getMethod)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ _addmethod */
|
||||
static void _addmethod(zend_function *mptr, zend_class_entry *ce, zval *retval, zend_long filter, zval *obj)
|
||||
static void _addmethod(zend_function *mptr, zend_class_entry *ce, zval *retval, zend_long filter)
|
||||
{
|
||||
zval method;
|
||||
size_t len = ZSTR_LEN(mptr->common.function_name);
|
||||
zend_function *closure;
|
||||
if (mptr->common.fn_flags & filter) {
|
||||
if (ce == zend_ce_closure && obj && (len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
|
||||
&& memcmp(ZSTR_VAL(mptr->common.function_name), ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
|
||||
&& (closure = zend_get_closure_invoke_method(Z_OBJ_P(obj))) != NULL)
|
||||
{
|
||||
mptr = closure;
|
||||
}
|
||||
/* don't assign closure_object since we only reflect the invoke handler
|
||||
method and not the closure definition itself, even if we have a
|
||||
closure */
|
||||
zval method;
|
||||
reflection_method_factory(ce, mptr, NULL, &method);
|
||||
add_next_index_zval(retval, &method);
|
||||
}
|
||||
@@ -4178,9 +4167,8 @@ static int _addmethod_va(zval *el, int num_args, va_list args, zend_hash_key *ha
|
||||
zend_class_entry *ce = *va_arg(args, zend_class_entry**);
|
||||
zval *retval = va_arg(args, zval*);
|
||||
long filter = va_arg(args, long);
|
||||
zval *obj = va_arg(args, zval *);
|
||||
|
||||
_addmethod(mptr, ce, retval, filter, obj);
|
||||
_addmethod(mptr, ce, retval, filter);
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -4205,12 +4193,24 @@ ZEND_METHOD(reflection_class, getMethods)
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
|
||||
array_init(return_value);
|
||||
zend_hash_apply_with_arguments(&ce->function_table, (apply_func_args_t) _addmethod_va, 4, &ce, return_value, filter, intern->obj);
|
||||
if (Z_TYPE(intern->obj) != IS_UNDEF && instanceof_function(ce, zend_ce_closure)) {
|
||||
zend_function *closure = zend_get_closure_invoke_method(Z_OBJ(intern->obj));
|
||||
zend_hash_apply_with_arguments(&ce->function_table, (apply_func_args_t) _addmethod_va, 4, &ce, return_value, filter);
|
||||
|
||||
if (instanceof_function(ce, zend_ce_closure)) {
|
||||
zend_bool has_obj = Z_TYPE(intern->obj) != IS_UNDEF;
|
||||
zval obj_tmp;
|
||||
zend_object *obj;
|
||||
if (!has_obj) {
|
||||
object_init_ex(&obj_tmp, ce);
|
||||
obj = Z_OBJ(obj_tmp);
|
||||
} else {
|
||||
obj = Z_OBJ(intern->obj);
|
||||
}
|
||||
zend_function *closure = zend_get_closure_invoke_method(obj);
|
||||
if (closure) {
|
||||
_addmethod(closure, ce, return_value, filter, &intern->obj);
|
||||
_free_function(closure);
|
||||
_addmethod(closure, ce, return_value, filter);
|
||||
}
|
||||
if (!has_obj) {
|
||||
zval_ptr_dtor(&obj_tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #75186: Inconsistent reflection of Closure:::__invoke()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$rc = new ReflectionClass(Closure::class);
|
||||
foreach ($rc->getMethods() as $method) {
|
||||
if ($method->name == '__invoke') {
|
||||
var_dump($method);
|
||||
$method->invoke(
|
||||
function($what) { echo "Hello $what!\n"; },
|
||||
"World"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(8) "__invoke"
|
||||
["class"]=>
|
||||
string(7) "Closure"
|
||||
}
|
||||
Hello World!
|
||||
@@ -750,7 +750,7 @@ static PHP_INI_MH(OnUpdateSidBits) /* {{{ */
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
php_error_docref(NULL, E_WARNING, "session.configuration 'session.sid_bits' must be between 4 and 6.");
|
||||
php_error_docref(NULL, E_WARNING, "session.configuration 'session.sid_bits_per_character' must be between 4 and 6.");
|
||||
return FAILURE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -6,7 +6,7 @@ Bug #32330 (session_destroy, "Failed to initialize storage module", custom sessi
|
||||
session.use_trans_sid=0
|
||||
session.use_cookies=1
|
||||
session.name=sid
|
||||
session.save_path=/tmp
|
||||
session.save_path={TMP}
|
||||
session.gc_probability=1
|
||||
session.gc_divisor=1
|
||||
session.save_handler=files
|
||||
@@ -69,17 +69,17 @@ $_SESSION['E'] = 'F';
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
open: path = /tmp, name = sid
|
||||
open: path = %s, name = sid
|
||||
read: id = %s
|
||||
gc: maxlifetime = %d
|
||||
write: id = %s, data = A|s:1:"B";
|
||||
close
|
||||
open: path = /tmp, name = sid
|
||||
open: path = %s, name = sid
|
||||
read: id = %s
|
||||
gc: maxlifetime = %d
|
||||
destroy: id = %s
|
||||
close
|
||||
open: path = /tmp, name = sid
|
||||
open: path = %s, name = sid
|
||||
read: id = %s
|
||||
gc: maxlifetime = %d
|
||||
write: id = %s, data = E|s:1:"F";
|
||||
|
||||
@@ -3,7 +3,7 @@ Test session_set_save_handler() function: create_sid
|
||||
--INI--
|
||||
session.save_handler=files
|
||||
session.name=PHPSESSID
|
||||
session.save_path=/tmp
|
||||
session.save_path={TMP}
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--FILE--
|
||||
|
||||
+34
-34
@@ -1,34 +1,34 @@
|
||||
<?xml encoding='US-ASCII'?>
|
||||
|
||||
<!ELEMENT sxe (elem1+, elem11, elem22*)>
|
||||
<!ATTLIST sxe id CDATA #implied>
|
||||
|
||||
<!ELEMENT elem1 elem2*>
|
||||
<!ATTLIST elem1 attr1 CDATA #required
|
||||
attr2 CDATA "default>
|
||||
|
||||
<!ELEMENT elem2 elem3*>
|
||||
<!ATTLIST elem2 att25 CDATA #implied
|
||||
att42 CDATA #implied>
|
||||
|
||||
<!ELEMENT elem3 elem4*>
|
||||
<!ATTLIST elem3>
|
||||
|
||||
<!ELEMENT elem4 EMPTY>
|
||||
<!ATTLIST elem4>
|
||||
|
||||
<!ELEMENT elem11 elem111*>
|
||||
<!ATTLIST elem11>
|
||||
|
||||
<!ELEMNET elem111 elem1111*>
|
||||
<!ATTLIST elem111>
|
||||
|
||||
<!ELEMENT elem1111 EMPTY>
|
||||
<!ATTLIST elem1111>
|
||||
|
||||
<!ELEMENT elem22 elem222*>
|
||||
<!ATTLIST elem22 attr22 CDATA #implied>
|
||||
|
||||
<!ELEMENT elem222 EMPTY>
|
||||
<!ATTLIST elem222>
|
||||
|
||||
<?xml encoding='US-ASCII'?>
|
||||
|
||||
<!ELEMENT sxe (elem1+, elem11, elem22*)>
|
||||
<!ATTLIST sxe id CDATA #implied>
|
||||
|
||||
<!ELEMENT elem1 elem2*>
|
||||
<!ATTLIST elem1 attr1 CDATA #required
|
||||
attr2 CDATA "default>
|
||||
|
||||
<!ELEMENT elem2 elem3*>
|
||||
<!ATTLIST elem2 att25 CDATA #implied
|
||||
att42 CDATA #implied>
|
||||
|
||||
<!ELEMENT elem3 elem4*>
|
||||
<!ATTLIST elem3>
|
||||
|
||||
<!ELEMENT elem4 EMPTY>
|
||||
<!ATTLIST elem4>
|
||||
|
||||
<!ELEMENT elem11 elem111*>
|
||||
<!ATTLIST elem11>
|
||||
|
||||
<!ELEMNET elem111 elem1111*>
|
||||
<!ATTLIST elem111>
|
||||
|
||||
<!ELEMENT elem1111 EMPTY>
|
||||
<!ATTLIST elem1111>
|
||||
|
||||
<!ELEMENT elem22 elem222*>
|
||||
<!ATTLIST elem22 attr22 CDATA #implied>
|
||||
|
||||
<!ELEMENT elem222 EMPTY>
|
||||
<!ATTLIST elem222>
|
||||
|
||||
Loaded 100 of 175 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user