mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-10 10:40:50 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c6de12b2d |
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.0
|
||||
PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0beta6
|
||||
PHP_BUILD_CRT: vc15
|
||||
# ext and env setup for tests
|
||||
#MYSQL_TEST_PASSWD: Password12!
|
||||
|
||||
@@ -1,417 +1,6 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
20 Feb 2020, PHP 7.3.15
|
||||
|
||||
- Core:
|
||||
. Fixed bug #71876 (Memory corruption htmlspecialchars(): charset `*' not
|
||||
supported). (Nikita)
|
||||
. Fixed bug ##79146 (cscript can fail to run on some systems). (clarodeus)
|
||||
. Fixed bug #78323 (Code 0 is returned on invalid options). (Ivan Mikheykin)
|
||||
. Fixed bug #76047 (Use-after-free when accessing already destructed
|
||||
backtrace arguments). (Nikita)
|
||||
|
||||
- CURL:
|
||||
. Fixed bug #79078 (Hypothetical use-after-free in curl_multi_add_handle()).
|
||||
(cmb)
|
||||
|
||||
-Intl:
|
||||
. Fixed bug #79212 (NumberFormatter::format() may detect wrong type). (cmb)
|
||||
|
||||
- Libxml:
|
||||
. Fixed bug #79191 (Error in SoapClient ctor disables DOMDocument::save()).
|
||||
(Nikita, cmb)
|
||||
|
||||
- MBString:
|
||||
. Fixed bug #79154 (mb_convert_encoding() can modify $from_encoding). (cmb)
|
||||
|
||||
- MySQLnd:
|
||||
. Fixed bug #79084 (mysqlnd may fetch wrong column indexes with MYSQLI_BOTH).
|
||||
(cmb)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #79145 (openssl memory leak). (cmb, Nikita)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #79082 (Files added to tar with Phar::buildFromIterator have
|
||||
all-access permissions). (CVE-2020-7063) (stas)
|
||||
. Fixed bug #79171 (heap-buffer-overflow in phar_extract_file).
|
||||
(CVE- 2020-7061) (cmb)
|
||||
. Fixed bug #76584 (PharFileInfo::decompress not working). (cmb)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug #79115 (ReflectionClass::isCloneable call reflected class
|
||||
__destruct). (Nikita)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #79221 (Null Pointer Dereference in PHP Session Upload Progress).
|
||||
(CVE-2020-7062) (stas)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #79151 (heap use after free caused by
|
||||
spl_dllist_it_helper_move_forward). (Nikita)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #78902 (Memory leak when using stream_filter_append). (liudaixiao)
|
||||
|
||||
- Testing:
|
||||
. Fixed bug #78090 (bug45161.phpt takes forever to finish). (cmb)
|
||||
|
||||
- XSL:
|
||||
. Fixed bug #70078 (XSL callbacks with nodes as parameter leak memory). (cmb)
|
||||
|
||||
23 Jan 2020, PHP 7.3.14
|
||||
|
||||
- Core
|
||||
. Fixed bug #78999 (Cycle leak when using function result as temporary).
|
||||
(Dmitry)
|
||||
|
||||
- CURL:
|
||||
. Fixed bug #79033 (Curl timeout error with specific url and post). (cmb)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #79015 (undefined-behavior in php_date.c). (cmb)
|
||||
|
||||
- DBA:
|
||||
. Fixed bug #78808 ([LMDB] MDB_MAP_FULL: Environment mapsize limit reached).
|
||||
(cmb)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #74170 (locale information change after mime_content_type).
|
||||
(Sergei Turchanov)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #78923 (Artifacts when convoluting image with transparency).
|
||||
(wilson chen)
|
||||
. Fixed bug #79067 (gdTransformAffineCopy() may use unitialized values). (cmb)
|
||||
. Fixed bug #79068 (gdTransformAffineCopy() changes interpolation method).
|
||||
(cmb)
|
||||
|
||||
- Libxml:
|
||||
. Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter). (Laruence)
|
||||
|
||||
- Mbstring:
|
||||
. Fixed bug #79037 (global buffer-overflow in `mbfl_filt_conv_big5_wchar`).
|
||||
(CVE-2020-7060) (Nikita)
|
||||
|
||||
- OPcache:
|
||||
. Fixed bug #79040 (Warning Opcode handlers are unusable due to ASLR). (cmb)
|
||||
|
||||
- Pcntl:
|
||||
. Fixed bug #78402 (Converting null to string in error message is bad DX).
|
||||
(SATŌ Kentarō)
|
||||
|
||||
- PDO_PgSQL:
|
||||
. Fixed bug #78983 (pdo_pgsql config.w32 cannot find libpq-fe.h). (SATŌ
|
||||
Kentarō)
|
||||
. Fixed bug #78980 (pgsqlGetNotify() overlooks dead connection). (SATŌ
|
||||
Kentarō)
|
||||
. Fixed bug #78982 (pdo_pgsql returns dead persistent connection). (SATŌ
|
||||
Kentarō)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #79091 (heap use-after-free in session_create_id()). (cmb, Nikita)
|
||||
|
||||
- Shmop:
|
||||
. Fixed bug #78538 (shmop memory leak). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #79099 (OOB read in php_strip_tags_ex). (CVE-2020-7059). (cmb)
|
||||
. Fixed bug #54298 (Using empty additional_headers adding extraneous CRLF).
|
||||
(cmb)
|
||||
|
||||
18 Dec 2019, PHP 7.3.13
|
||||
|
||||
- Bcmath:
|
||||
. Fixed bug #78878 (Buffer underflow in bc_shift_addsub). (CVE-2019-11046).
|
||||
(cmb)
|
||||
|
||||
- Core:
|
||||
. Fixed bug #78862 (link() silently truncates after a null byte on Windows).
|
||||
(CVE-2019-11044). (cmb)
|
||||
. Fixed bug #78863 (DirectoryIterator class silently truncates after a null
|
||||
byte). (CVE-2019-11045). (cmb)
|
||||
. Fixed bug #78943 (mail() may release string with refcount==1 twice).
|
||||
(CVE-2019-11049). (cmb)
|
||||
. Fixed bug #78787 (Segfault with trait overriding inherited private shadow
|
||||
property). (Nikita)
|
||||
. Fixed bug #78868 (Calling __autoload() with incorrect EG(fake_scope) value).
|
||||
(Antony Dovgal, Dmitry)
|
||||
. Fixed bug #78296 (is_file fails to detect file). (cmb)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #78793 (Use-after-free in exif parsing under memory sanitizer).
|
||||
(CVE-2019-11050). (Nikita)
|
||||
. Fixed bug #78910 (Heap-buffer-overflow READ in exif). (CVE-2019-11047).
|
||||
(Nikita)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #78849 (GD build broken with -D SIGNED_COMPARE_SLOW). (cmb)
|
||||
|
||||
- MBString:
|
||||
. Upgraded bundled Oniguruma to 6.9.4. (cmb)
|
||||
|
||||
- OPcache:
|
||||
. Fixed potential ASLR related invalid opline handler issues. (cmb)
|
||||
. Fixed $x = (bool)$x; with opcache (should emit undeclared variable notice).
|
||||
(Tyson Andre)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #78853 (preg_match() may return integer > 1). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #78759 (array_search in $GLOBALS). (Nikita)
|
||||
. Fixed bug #77638 (var_export'ing certain class instances segfaults). (cmb)
|
||||
. Fixed bug #78840 (imploding $GLOBALS crashes). (cmb)
|
||||
. Fixed bug #78833 (Integer overflow in pack causes out-of-bound access).
|
||||
(cmb)
|
||||
. Fixed bug #78814 (strip_tags allows / in tag name => whitelist bypass).
|
||||
(cmb)
|
||||
|
||||
21 Nov 2019, PHP 7.3.12
|
||||
|
||||
- Core:
|
||||
. Fixed bug #78658 (Memory corruption using Closure::bindTo). (Nikita)
|
||||
. Fixed bug #78656 (Parse errors classified as highest log-level). (Erik
|
||||
Lundin)
|
||||
. Fixed bug #78752 (Segfault if GC triggered while generator stack frame is
|
||||
being destroyed). (Nikita)
|
||||
. Fixed bug #78689 (Closure::fromCallable() doesn't handle
|
||||
[Closure, '__invoke']). (Nikita)
|
||||
|
||||
- COM:
|
||||
. Fixed bug #78694 (Appending to a variant array causes segfault). (cmb)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #70153 (\DateInterval incorrectly unserialized). (Maksim Iakunin)
|
||||
. Fixed bug #78751 (Serialising DatePeriod converts DateTimeImmutable). (cmb)
|
||||
|
||||
- Iconv:
|
||||
. Fixed bug #78642 (Wrong libiconv version displayed). (gedas at martynas,
|
||||
cmb).
|
||||
|
||||
- OpCache:
|
||||
. Fixed bug #78654 (Incorrectly computed opcache checksum on files with
|
||||
non-ascii characters). (mhagstrand)
|
||||
. Fixed bug #78747 (OpCache corrupts custom extension result). (Nikita)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #78775 (TLS issues from HTTP request affecting other encrypted
|
||||
connections). (Nikita)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug #78697 (ReflectionClass::ImplementsInterface - inaccurate error
|
||||
message with traits). (villfa)
|
||||
|
||||
- Sockets:
|
||||
. Fixed bug #78665 (Multicasting may leak memory). (cmb)
|
||||
|
||||
24 Oct 2019, PHP 7.3.11
|
||||
|
||||
- Core:
|
||||
. Fixed bug #78535 (auto_detect_line_endings value not parsed as bool).
|
||||
(bugreportuser)
|
||||
. Fixed bug #78620 (Out of memory error). (cmb, Nikita)
|
||||
|
||||
- Exif :
|
||||
. Fixed bug #78442 ('Illegal component' on exif_read_data since PHP7)
|
||||
(Kalle)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #78599 (env_path_info underflow in fpm_main.c can lead to RCE).
|
||||
(CVE-2019-11043) (Jakub Zelenka)
|
||||
. Fixed bug #78413 (request_terminate_timeout does not take effect after
|
||||
fastcgi_finish_request). (Sergei Turchanov)
|
||||
|
||||
- MBString:
|
||||
. Fixed bug #78633 (Heap buffer overflow (read) in mb_eregi). (cmb)
|
||||
. Fixed bug #78579 (mb_decode_numericentity: args number inconsistency).
|
||||
(cmb)
|
||||
. Fixed bug #78609 (mb_check_encoding() no longer supports stringable
|
||||
objects). (cmb)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #76809 (SSL settings aren't respected when persistent connections
|
||||
are used). (fabiomsouto)
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed bug #78525 (Memory leak in pdo when reusing native prepared
|
||||
statements). (Nikita)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #78272 (calling preg_match() before pcntl_fork() will freeze
|
||||
child process). (Nikita)
|
||||
|
||||
- PDO_MySQL:
|
||||
. Fixed bug #78623 (Regression caused by "SP call yields additional empty
|
||||
result set"). (cmb)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #78624 (session_gc return value for user defined session
|
||||
handlers). (bshaffer)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #76342 (file_get_contents waits twice specified timeout).
|
||||
(Thomas Calvet)
|
||||
. Fixed bug #78612 (strtr leaks memory when integer keys are used and the
|
||||
subject string shorter). (Nikita)
|
||||
. Fixed bug #76859 (stream_get_line skips data if used with data-generating
|
||||
filter). (kkopachev)
|
||||
|
||||
- Zip:
|
||||
. Fixed bug #78641 (addGlob can modify given remove_path value). (cmb)
|
||||
|
||||
26 Sep 2019, PHP 7.3.10
|
||||
|
||||
- Core:
|
||||
. Fixed bug #78220 (Can't access OneDrive folder). (cmb, ab)
|
||||
. Fixed bug #77922 (Double release of doc comment on inherited shadow
|
||||
property). (Nikita)
|
||||
. Fixed bug #78441 (Parse error due to heredoc identifier followed by digit).
|
||||
(cmb)
|
||||
. Fixed bug #77812 (Interactive mode does not support PHP 7.3-style heredoc).
|
||||
(cmb, Nikita)
|
||||
|
||||
- FastCGI:
|
||||
. Fixed bug #78469 (FastCGI on_accept hook is not called when using named
|
||||
pipes on Windows). (Sergei Turchanov)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #78334 (fpm log prefix message includes wrong stdout/stderr
|
||||
notation). (Tsuyoshi Sadakata)
|
||||
|
||||
- Intl:
|
||||
. Ensure IDNA2003 rules are used with idn_to_ascii() and idn_to_utf8()
|
||||
when requested. (Sara)
|
||||
|
||||
- MBString:
|
||||
. Fixed bug #78559 (Heap buffer overflow in mb_eregi). (cmb)
|
||||
|
||||
- MySQLnd:
|
||||
. Fixed connect_attr issues and added the _server_host connection attribute.
|
||||
(Qianqian Bu)
|
||||
|
||||
- ODBC:
|
||||
. Fixed bug #78473 (odbc_close() closes arbitrary resources). (cmb)
|
||||
|
||||
- PDO_MySQL:
|
||||
. Fixed bug #41997 (SP call yields additional empty result set). (cmb)
|
||||
|
||||
- sodium:
|
||||
. Fixed bug #78510 (Partially uninitialized buffer returned by
|
||||
sodium_crypto_generichash_init()). (Frank Denis, cmb)
|
||||
|
||||
29 Aug 2019, PHP 7.3.9
|
||||
|
||||
- Core:
|
||||
. Fixed bug #78363 (Buffer overflow in zendparse). (Nikita)
|
||||
. Fixed bug #78379 (Cast to object confuses GC, causes crash). (Dmitry)
|
||||
. Fixed bug #78412 (Generator incorrectly reports non-releasable $this as GC
|
||||
child). (Nikita)
|
||||
|
||||
- Curl:
|
||||
. Fixed bug #77946 (Bad cURL resources returned by curl_multi_info_read()).
|
||||
(Abyr Valg)
|
||||
|
||||
- Exif:
|
||||
. Fixed bug #78333 (Exif crash (bus error) due to wrong alignment and
|
||||
invalid cast). (Nikita)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #77185 (Use-after-free in FPM master event handling).
|
||||
(Maksim Nikulin)
|
||||
|
||||
- Iconv:
|
||||
. Fixed bug #78342 (Bus error in configure test for iconv //IGNORE). (Rainer
|
||||
Jung)
|
||||
|
||||
- LiteSpeed:
|
||||
. Updated to LiteSpeed SAPI V7.5 (Fixed clean shutdown). (George Wang)
|
||||
|
||||
- MBString:
|
||||
. Fixed bug #78380 (Oniguruma 6.9.3 fixes CVEs). (CVE-2019-13224) (Stas)
|
||||
|
||||
- MySQLnd:
|
||||
. Fixed bug #78179 (MariaDB server version incorrectly detected). (cmb)
|
||||
. Fixed bug #78213 (Empty row pocket). (cmb)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #77191 (Assertion failure in dce_live_ranges() when silencing is
|
||||
used). (Nikita)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #69100 (Bus error from stream_copy_to_stream (file -> SSL stream)
|
||||
with invalid length). (Nikita)
|
||||
. Fixed bug #78282 (atime and mtime mismatch). (cmb)
|
||||
. Fixed bug #78326 (improper memory deallocation on stream_get_contents()
|
||||
with fixed length buffer). (Albert Casademont)
|
||||
. Fixed bug #78346 (strip_tags no longer handling nested php tags). (cmb)
|
||||
|
||||
01 Aug 2019, PHP 7.3.8
|
||||
|
||||
- Core:
|
||||
. Added syslog.filter=raw option. (Erik Lundin)
|
||||
. Fixed bug #78212 (Segfault in built-in webserver). (cmb)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #69044 (discrepency between time and microtime). (krakjoe)
|
||||
. Updated timelib to 2018.02. (Derick)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #78256 (heap-buffer-overflow on exif_process_user_comment).
|
||||
(CVE-2019-11042) (Stas)
|
||||
. Fixed bug #78222 (heap-buffer-overflow on exif_scan_thumbnail).
|
||||
(CVE-2019-11041) (Stas)
|
||||
|
||||
- FTP:
|
||||
. Fixed bug #78039 (FTP with SSL memory leak). (Nikita)
|
||||
|
||||
- Libxml:
|
||||
. Fixed bug #78279 (libxml_disable_entity_loader settings is shared between
|
||||
requests (cgi-fcgi)). (Nikita)
|
||||
|
||||
- LiteSpeed:
|
||||
. Updated to LiteSpeed SAPI V7.4.3 (increased response header count limit from
|
||||
100 to 1000, added crash handler to cleanly shutdown PHP request, added
|
||||
CloudLinux mod_lsapi mode). (George Wang)
|
||||
. Fixed bug #76058 (After "POST data can't be buffered", using php://input
|
||||
makes huge tmp files). (George Wang)
|
||||
|
||||
- Openssl:
|
||||
. Fixed bug #78231 (Segmentation fault upon stream_socket_accept of exported
|
||||
socket-to-stream). (Nikita)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #78189 (file cache strips last character of uname hash). (cmb)
|
||||
. Fixed bug #78202 (Opcache stats for cache hits are capped at 32bit NUM).
|
||||
(cmb)
|
||||
. Fixed bug #78271 (Invalid result of if-else). (Nikita)
|
||||
. Fixed bug #78291 (opcache_get_configuration doesn't list all directives).
|
||||
(Andrew Collington)
|
||||
. Fixed bug #78341 (Failure to detect smart branch in DFA pass). (Nikita)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #78197 (PCRE2 version check in configure fails for "##.##-xxx"
|
||||
version strings). (pgnet, Peter Kokot)
|
||||
. Fixed bug #78338 (Array cross-border reading in PCRE). (cmb)
|
||||
|
||||
- PDO_Sqlite:
|
||||
. Fixed bug #78192 (SegFault when reuse statement after schema has changed).
|
||||
(Vincent Quatrevieux)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #77919 (Potential UAF in Phar RSHUTDOWN). (cmb)
|
||||
|
||||
- Phpdbg:
|
||||
. Fixed bug #78297 (Include unexistent file memory leak). (Nikita)
|
||||
|
||||
- SQLite:
|
||||
. Upgraded to SQLite 3.28.0. (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #78241 (touch() does not handle dates after 2038 in PHP 64-bit). (cmb)
|
||||
. Fixed bug #78269 (password_hash uses weak options for argon2). (Remi)
|
||||
|
||||
04 Jul 2019, PHP 7.3.7
|
||||
13 Jun 2019, PHP 7.3.7RC1
|
||||
|
||||
- Core:
|
||||
. Fixed bug #76980 (Interface gets skipped if autoloader throws an exception).
|
||||
@@ -434,8 +23,6 @@ PHP NEWS
|
||||
- Opcache:
|
||||
. Fixed bug #78015 (Incorrect evaluation of expressions involving partials
|
||||
arrays in SCCP). (Nikita)
|
||||
. Fixed bug #78106 (Path resolution fails if opcache disabled during request).
|
||||
(Nikita)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #78079 (openssl_encrypt_ccm.phpt fails with OpenSSL 1.1.1c).
|
||||
@@ -455,7 +42,7 @@ PHP NEWS
|
||||
- Standard:
|
||||
. Fixed bug #77135 (Extract with EXTR_SKIP should skip $this).
|
||||
(Craig Duncan, Dmitry)
|
||||
. Fixed bug #77937 (preg_match failed). (cmb, Anatol)
|
||||
. Fixed bug ##77937 (preg_match failed). (cmb, Anatol)
|
||||
|
||||
- Zip:
|
||||
. Fixed bug #76345 (zip.h not found). (Michael Maroszek)
|
||||
@@ -466,10 +53,6 @@ PHP NEWS
|
||||
. Implemented FR #72189 (Add missing CURL_VERSION_* constants). (Javier
|
||||
Spagnoletti)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #77909 (DatePeriod::__construct() with invalid recurrence count
|
||||
value). (Ignace Nyamagana Butera)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #77988 (heap-buffer-overflow on php_jpg_get16).
|
||||
(CVE-2019-11040) (Stas)
|
||||
|
||||
+2
-8
@@ -721,7 +721,6 @@ TSRM_API void *shmat(int key, const void *shmaddr, int flags)
|
||||
TSRM_API int shmdt(const void *shmaddr)
|
||||
{/*{{{*/
|
||||
shm_pair *shm = shm_get(0, (void*)shmaddr);
|
||||
int ret;
|
||||
|
||||
if (!shm->segment) {
|
||||
return -1;
|
||||
@@ -731,12 +730,7 @@ TSRM_API int shmdt(const void *shmaddr)
|
||||
shm->descriptor->shm_lpid = getpid();
|
||||
shm->descriptor->shm_nattch--;
|
||||
|
||||
ret = UnmapViewOfFile(shm->addr) ? 0 : -1;
|
||||
if (!ret && shm->descriptor->shm_nattch <= 0) {
|
||||
ret = UnmapViewOfFile(shm->descriptor) ? 0 : -1;
|
||||
shm->descriptor = NULL;
|
||||
}
|
||||
return ret;
|
||||
return UnmapViewOfFile(shm->addr) ? 0 : -1;
|
||||
}/*}}}*/
|
||||
|
||||
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf)
|
||||
@@ -776,7 +770,7 @@ static zend_always_inline void UnixTimeToFileTime(time_t t, LPFILETIME pft) /* {
|
||||
// Note that LONGLONG is a 64-bit value
|
||||
LONGLONG ll;
|
||||
|
||||
ll = t * 10000000LL + 116444736000000000LL;
|
||||
ll = Int32x32To64(t, 10000000) + 116444736000000000;
|
||||
pft->dwLowDateTime = (DWORD)ll;
|
||||
pft->dwHighDateTime = ll >> 32;
|
||||
}
|
||||
|
||||
@@ -273,10 +273,6 @@ FPM:
|
||||
disabling output decoration for workers output when catch_workers_output
|
||||
enabled.
|
||||
. The getallheaders() function is now also available.
|
||||
. In PHP 7.3.11 a new pool option
|
||||
request_terminate_timeout_track_finished has been added. When enabled,
|
||||
request_terminate_timeout will also apply after fastcgi_finish_request()
|
||||
has been called, as well as during execution of shutdown functions.
|
||||
|
||||
========================================
|
||||
4. Deprecated Functionality
|
||||
@@ -490,12 +486,6 @@ JSON:
|
||||
Curl:
|
||||
. libcurl >= 7.15.5 is now required.
|
||||
|
||||
DBA:
|
||||
. As of PHP 7.3.14, dba_open() accepts a fifth optional parameter for lmdb
|
||||
databases which allows to specify the mapsize. The parameter defaults to
|
||||
zero, in which case the compiled in default mapsize (usually 1048576) will
|
||||
be used. The mapsize should be a multiple of the page size of the OS.
|
||||
|
||||
Filter:
|
||||
. FILTER_VALIDATE_FLOAT now also supports a `thousand` option, which
|
||||
defines the set of allowed thousand separator chars. The default (`"',."`)
|
||||
|
||||
@@ -94,7 +94,7 @@ L0:
|
||||
}
|
||||
}));
|
||||
|
||||
assert(0 && ($a = function &(?array &$a, X $b = null) use ($c,&$d) : X {
|
||||
assert(0 && ($a = function &(array &$a, X $b = null) use ($c,&$d) : X {
|
||||
class A {
|
||||
use T1, T2 {
|
||||
T1::foo insteadof foo;
|
||||
@@ -140,7 +140,6 @@ assert(0 && ($a = function () {
|
||||
if ($a) {
|
||||
} elseif ($b) {
|
||||
}
|
||||
if ($a); else;
|
||||
}));
|
||||
|
||||
?>
|
||||
@@ -244,7 +243,7 @@ Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c,
|
||||
|
||||
})) failed in %sexpect_015.php on line %d
|
||||
|
||||
Warning: assert(): assert(0 && ($a = function &(?array &$a, X $b = null) use($c, &$d): X {
|
||||
Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c, &$d): X {
|
||||
class A {
|
||||
use T1, T2 {
|
||||
T1::foo insteadof foo;
|
||||
@@ -293,7 +292,4 @@ Warning: assert(): assert(0 && ($a = function () {
|
||||
if ($a) {
|
||||
} elseif ($b) {
|
||||
}
|
||||
if ($a) {
|
||||
} else {
|
||||
}
|
||||
})) failed in %sexpect_015.php on line %d
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
AST pretty-printer
|
||||
--INI--
|
||||
zend.assertions=1
|
||||
assert.exception=0
|
||||
--FILE--
|
||||
<?php
|
||||
assert(0 && ($a = function () {
|
||||
$var = 'test';
|
||||
$str = "$var, $var[1], {$var}[], {$var[1]}[], ${var}[], ${var[1]}[]";
|
||||
}));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: assert(): assert(0 && ($a = function () {
|
||||
$var = 'test';
|
||||
$str = "$var, {$var[1]}, {$var}[], {$var[1]}[], {$var}[], {$var[1]}[]";
|
||||
})) failed in %sexpect_020.php on line %d
|
||||
@@ -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
|
||||
@@ -25,8 +25,9 @@ try {
|
||||
--EXPECTF--
|
||||
1. Exception: aaa in %sbug52361.php:5
|
||||
Stack trace:
|
||||
#0 %sbug52361.php(16): aaa->__destruct()
|
||||
#1 {main}
|
||||
#0 %sbug52361.php(13): aaa->__destruct()
|
||||
#1 %sbug52361.php(16): bbb()
|
||||
#2 {main}
|
||||
2. Exception: bbb in %sbug52361.php:13
|
||||
Stack trace:
|
||||
#0 %sbug52361.php(16): bbb()
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
--TEST--
|
||||
Bug #76047: Use-after-free when accessing already destructed backtrace arguments
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Vuln {
|
||||
public $a;
|
||||
public function __destruct() {
|
||||
unset($this->a);
|
||||
$backtrace = (new Exception)->getTrace();
|
||||
var_dump($backtrace);
|
||||
}
|
||||
}
|
||||
|
||||
function test($arg) {
|
||||
$arg = str_shuffle(str_repeat('A', 79));
|
||||
$vuln = new Vuln();
|
||||
$vuln->a = $arg;
|
||||
}
|
||||
|
||||
function test2($arg) {
|
||||
$$arg = 1; // Trigger symbol table
|
||||
$arg = str_shuffle(str_repeat('A', 79));
|
||||
$vuln = new Vuln();
|
||||
$vuln->a = $arg;
|
||||
}
|
||||
|
||||
test('x');
|
||||
test2('x');
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(6) {
|
||||
["file"]=>
|
||||
string(%d) "%s"
|
||||
["line"]=>
|
||||
int(%d)
|
||||
["function"]=>
|
||||
string(10) "__destruct"
|
||||
["class"]=>
|
||||
string(4) "Vuln"
|
||||
["type"]=>
|
||||
string(2) "->"
|
||||
["args"]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(6) {
|
||||
["file"]=>
|
||||
string(%d) "%s"
|
||||
["line"]=>
|
||||
int(%d)
|
||||
["function"]=>
|
||||
string(10) "__destruct"
|
||||
["class"]=>
|
||||
string(4) "Vuln"
|
||||
["type"]=>
|
||||
string(2) "->"
|
||||
["args"]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Bug #77922: Double release of doc comment on inherited shadow property
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
/** Foo */
|
||||
private $prop;
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
}
|
||||
|
||||
class C extends B {
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -1,32 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78010: Segmentation fault during GC
|
||||
--INI--
|
||||
memory_limit=2G
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class foo
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->x = $this;
|
||||
|
||||
for ($i = 0; $i < 898; $i++) { //Will not trigger with <898
|
||||
$obj = [new stdClass, new stdClass]; //This must have at least 2 elements
|
||||
$this->y[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < 2; ++$i) { //This must run >=2 (increasing the number of elements in the array *2 will not do)
|
||||
$x = []; //This must be reset
|
||||
foreach (array_fill(0, 389, 'x') as &$params) { //Will not trigger <389
|
||||
$x[] = new foo;
|
||||
}
|
||||
}
|
||||
|
||||
echo "Completed\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Completed
|
||||
@@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78271: Invalid result of if-else
|
||||
--FILE--
|
||||
<?php
|
||||
function test($a, $b){
|
||||
if ($a==10) {
|
||||
$w="x";
|
||||
} else {
|
||||
$w="y";
|
||||
}
|
||||
|
||||
if ($b) {
|
||||
$d1="none";
|
||||
$d2="block";
|
||||
} else {
|
||||
$d1="block";
|
||||
$d2="none";
|
||||
}
|
||||
|
||||
echo $d2.$b."\n";
|
||||
|
||||
}
|
||||
|
||||
test(1, 1);
|
||||
?>
|
||||
--EXPECT--
|
||||
block1
|
||||
Binary file not shown.
@@ -1,32 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78379 (Cast to object confuses GC, causes crash)
|
||||
--INI--
|
||||
opcache.enable=0
|
||||
--FILE--
|
||||
<?php
|
||||
class C {
|
||||
public function __construct() {
|
||||
$this->p = (object)["x" => [1]];
|
||||
}
|
||||
}
|
||||
class E {
|
||||
}
|
||||
$e = new E;
|
||||
$e->f = new E;
|
||||
$e->f->e = $e;
|
||||
$e->a = new C;
|
||||
$e = null;
|
||||
gc_collect_cycles();
|
||||
var_dump(new C);
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(C)#%d (1) {
|
||||
["p"]=>
|
||||
object(stdClass)#%d (1) {
|
||||
["x"]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78379.2 (Cast to object confuses GC, causes crash)
|
||||
--FILE--
|
||||
<?php
|
||||
class E {}
|
||||
function f() {
|
||||
$e1 = new E;
|
||||
$e2 = new E;
|
||||
$a = ['e2' => $e2];
|
||||
$e1->a = (object)$a;
|
||||
$e2->e1 = $e1;
|
||||
$e2->a = (object)$a;
|
||||
}
|
||||
f();
|
||||
gc_collect_cycles();
|
||||
echo "End\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
End
|
||||
@@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78658: Memory corruption using Closure::bindTo()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$c = function(){};
|
||||
|
||||
$scope = "AAAA";
|
||||
$scope = "{$scope}BBBB";
|
||||
$c->bindTo(new stdClass, $scope);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Class 'AAAABBBB' not found in %s on line %d
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78689: Closure::fromCallable() doesn't handle [Closure, '__invoke']
|
||||
--FILE--
|
||||
<?php
|
||||
$a = [function () { echo "123\n"; }, '__invoke'];
|
||||
$a();
|
||||
|
||||
$b = Closure::fromCallable($a);
|
||||
$b();
|
||||
?>
|
||||
--EXPECT--
|
||||
123
|
||||
123
|
||||
@@ -1,24 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78752: Segfault if GC triggered while generator stack frame is being destroyed
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function gen(&$gen) {
|
||||
$a = new stdClass;
|
||||
$a->a = $a;
|
||||
$b = new stdClass;
|
||||
$b->b = $b;
|
||||
yield 1;
|
||||
}
|
||||
|
||||
$gen = gen($gen);
|
||||
var_dump($gen->current());
|
||||
for ($i = 0; $i < 9999; $i++) {
|
||||
$a = new stdClass;
|
||||
$a->a = $a;
|
||||
}
|
||||
$gen->next();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78787: Segfault with trait overriding inherited private shadow property
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait T {
|
||||
private $prop;
|
||||
}
|
||||
class C1 {
|
||||
/** Doc comment */
|
||||
private $prop;
|
||||
}
|
||||
class C2 extends C1 {
|
||||
}
|
||||
class C3 extends C2 {
|
||||
use T;
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78868: Calling __autoload() with incorrect EG(fake_scope) value
|
||||
--FILE--
|
||||
<?php
|
||||
class C {
|
||||
private $private = 1;
|
||||
|
||||
function foo() {
|
||||
$this->private++; //fails with EG(fake_scope) != NULL && EG(fake_scope) != "C"
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
static $foo = B::foo; //not resolved on include()
|
||||
}
|
||||
|
||||
function main_autoload($class_name) {
|
||||
$c = new C;
|
||||
$c->foo();
|
||||
//doesn't affect the error
|
||||
eval("class B {const foo = 1;}");
|
||||
}
|
||||
|
||||
spl_autoload_register('main_autoload', false);
|
||||
|
||||
$classA = new ReflectionClass("A");
|
||||
$props = $classA->getProperties();
|
||||
$props[0]->setValue(2); //causes constant resolving, which runs autoload, all with EG(fake_scope) == "A"
|
||||
|
||||
echo "OK\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
@@ -1,36 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78921: When Reflection triggers class load, property visibility is incorrect
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
spl_autoload_register(function($className) {
|
||||
if ($className == 'PrivateStatic') {
|
||||
class PrivateStatic
|
||||
{
|
||||
const SOME_CONST = 13;
|
||||
private static $privateStaticVarArray = ['a', 'b', 'c'];
|
||||
private static $otherStatic;
|
||||
public static function init()
|
||||
{
|
||||
self::$otherStatic = self::$privateStaticVarArray;
|
||||
}
|
||||
}
|
||||
PrivateStatic::init();
|
||||
}
|
||||
});
|
||||
|
||||
class OtherClass
|
||||
{
|
||||
const MY_CONST = PrivateStatic::SOME_CONST;
|
||||
public static $prop = 'my property';
|
||||
}
|
||||
|
||||
$reflectionClass = new ReflectionClass('OtherClass');
|
||||
$reflectionProperty = $reflectionClass->getProperty('prop');
|
||||
$reflectionProperty->setAccessible(true);
|
||||
$value = $reflectionProperty->getValue();
|
||||
echo "Value is $value\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Value is my property
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78999 (Cycle leak when using function result as temporary)
|
||||
--FILE--
|
||||
<?php
|
||||
function get() {
|
||||
$t = new stdClass;
|
||||
$t->prop = $t;
|
||||
return $t;
|
||||
}
|
||||
var_dump(get());
|
||||
var_dump(gc_collect_cycles());
|
||||
--EXPECT--
|
||||
object(stdClass)#1 (1) {
|
||||
["prop"]=>
|
||||
*RECURSION*
|
||||
}
|
||||
int(1)
|
||||
@@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
Immediately invoked closure with extra args
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
(function() {})(new stdClass);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -1,9 +0,0 @@
|
||||
--TEST--
|
||||
Incorrect constant evaluation of and/or (OSS-Fuzz #19255)
|
||||
--FILE--
|
||||
<?php
|
||||
const C = 0 && __namespace__;
|
||||
var_dump(C);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
@@ -1,28 +0,0 @@
|
||||
--TEST--
|
||||
Freeing of function "name" when dynamic call fails
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
$bar = "bar";
|
||||
("foo" . $bar)();
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
try {
|
||||
$bar = ["bar"];
|
||||
(["foo"] + $bar)();
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
try {
|
||||
(new stdClass)();
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Call to undefined function foobar()
|
||||
Function name must be a string
|
||||
Function name must be a string
|
||||
@@ -1,35 +0,0 @@
|
||||
--TEST--
|
||||
GC 041: Handling of references in nested data of objects with destructor
|
||||
--INI--
|
||||
zend.enable_gc = 1
|
||||
--FILE--
|
||||
<?php
|
||||
class ryat {
|
||||
var $ryat;
|
||||
var $chtg;
|
||||
var $nested;
|
||||
function __destruct() {
|
||||
$GLOBALS['x'] = $this;
|
||||
}
|
||||
}
|
||||
$o = new ryat;
|
||||
$o->nested = [];
|
||||
$o->nested[] =& $o->nested;
|
||||
$o->ryat = $o;
|
||||
$x =& $o->chtg;
|
||||
unset($o);
|
||||
gc_collect_cycles();
|
||||
var_dump($x);
|
||||
?>
|
||||
--EXPECT--
|
||||
object(ryat)#1 (3) {
|
||||
["ryat"]=>
|
||||
*RECURSION*
|
||||
["chtg"]=>
|
||||
*RECURSION*
|
||||
["nested"]=>
|
||||
&array(1) {
|
||||
[0]=>
|
||||
*RECURSION*
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
--TEST--
|
||||
Object properties HT may need to be removed from nested data
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
public function __destruct() {
|
||||
$GLOBALS['x'] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
$t = new Test;
|
||||
$t->x = new stdClass;
|
||||
$t->x->t = $t;
|
||||
$a = (array) $t->x;
|
||||
unset($t, $a);
|
||||
gc_collect_cycles();
|
||||
var_dump($x);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(Test)#1 (1) {
|
||||
["x"]=>
|
||||
object(stdClass)#2 (1) {
|
||||
["t"]=>
|
||||
*RECURSION*
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Generator exceptions during shutdown should not be swallowed
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function gen() {
|
||||
try {
|
||||
echo "before yield\n";
|
||||
yield;
|
||||
echo "after yield\n";
|
||||
} finally {
|
||||
echo "before yield in finally\n";
|
||||
yield;
|
||||
echo "after yield in finally\n";
|
||||
}
|
||||
echo "after finally\n";
|
||||
}
|
||||
|
||||
$gen = gen();
|
||||
$gen->rewind();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
before yield
|
||||
before yield in finally
|
||||
|
||||
Fatal error: Uncaught Error: Cannot yield from finally in a force-closed generator in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -1,24 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78441 (Parse error due to heredoc identifier followed by digit)
|
||||
--FILE--
|
||||
<?php
|
||||
echo <<<FOO
|
||||
FOO4
|
||||
FOO, PHP_EOL;
|
||||
|
||||
echo <<<FOO
|
||||
bar
|
||||
FOO4
|
||||
FOO, PHP_EOL;
|
||||
|
||||
echo <<<'FOO'
|
||||
bar
|
||||
FOO4
|
||||
FOO, PHP_EOL;
|
||||
?>
|
||||
--EXPECT--
|
||||
FOO4
|
||||
bar
|
||||
FOO4
|
||||
bar
|
||||
FOO4
|
||||
@@ -1,8 +0,0 @@
|
||||
--TEST--
|
||||
Using __COMPILER_HALF_OFFSET__ with trailing {} (OSS-Fuzz #17895)
|
||||
--FILE--
|
||||
<?php
|
||||
__COMPILER_HALT_OFFSET__;
|
||||
{}
|
||||
--EXPECTF--
|
||||
Warning: Use of undefined constant __COMPILER_HALT_OFFSET__ - assumed '__COMPILER_HALT_OFFSET__' (this will throw an Error in a future version of PHP) in %s on line %d
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Memory leak on ** with result==op1 array
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$x = [0];
|
||||
$x **= 1;
|
||||
var_dump($x);
|
||||
|
||||
$x = [0];
|
||||
$x **= $x;
|
||||
var_dump($x);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
int(0)
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Calling a static method on a non-existing class
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$str = "foo";
|
||||
try {
|
||||
Test::{$str . "bar"}();
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Class 'Test' not found
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
No warnings should be thrown during heredoc scan-ahead
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
<<<TEST
|
||||
${x}
|
||||
\400
|
||||
${/*}
|
||||
TEST;
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Unexpected character in input: '' (ASCII=1) state=0 in %s on line %d
|
||||
|
||||
Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
|
||||
|
||||
Warning: Unterminated comment starting line %d in %s on line %d
|
||||
|
||||
Parse error: syntax error, unexpected end of file in %s on line %d
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "3.3.15"
|
||||
#define ZEND_VERSION "3.3.7RC1"
|
||||
|
||||
#define ZEND_ENGINE_3
|
||||
|
||||
|
||||
@@ -4082,12 +4082,6 @@ ZEND_API int zend_update_static_property_ex(zend_class_entry *scope, zend_string
|
||||
zval *property;
|
||||
zend_class_entry *old_scope = EG(fake_scope);
|
||||
|
||||
if (UNEXPECTED(!(scope->ce_flags & ZEND_ACC_CONSTANTS_UPDATED))) {
|
||||
if (UNEXPECTED(zend_update_class_constants(scope)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
EG(fake_scope) = scope;
|
||||
property = zend_std_get_static_property(scope, name, 0);
|
||||
EG(fake_scope) = old_scope;
|
||||
|
||||
+7
-12
@@ -982,7 +982,7 @@ get_chunk:
|
||||
heap->cached_chunks = chunk->next;
|
||||
} else {
|
||||
#if ZEND_MM_LIMIT
|
||||
if (UNEXPECTED(ZEND_MM_CHUNK_SIZE > heap->limit - heap->real_size)) {
|
||||
if (UNEXPECTED(heap->real_size + ZEND_MM_CHUNK_SIZE > heap->limit)) {
|
||||
if (zend_mm_gc(heap)) {
|
||||
goto get_chunk;
|
||||
} else if (heap->overflow == 0) {
|
||||
@@ -1510,8 +1510,8 @@ static zend_never_inline void *zend_mm_realloc_huge(zend_mm_heap *heap, void *pt
|
||||
}
|
||||
} else /* if (new_size > old_size) */ {
|
||||
#if ZEND_MM_LIMIT
|
||||
if (UNEXPECTED(new_size - old_size > heap->limit - heap->real_size)) {
|
||||
if (zend_mm_gc(heap) && new_size - old_size <= heap->limit - heap->real_size) {
|
||||
if (UNEXPECTED(heap->real_size + (new_size - old_size) > heap->limit)) {
|
||||
if (zend_mm_gc(heap) && heap->real_size + (new_size - old_size) <= heap->limit) {
|
||||
/* pass */
|
||||
} else if (heap->overflow == 0) {
|
||||
#if ZEND_DEBUG
|
||||
@@ -1792,20 +1792,15 @@ static void *zend_mm_alloc_huge(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D
|
||||
* We allocate them with 2MB size granularity, to avoid many
|
||||
* reallocations when they are extended by small pieces
|
||||
*/
|
||||
size_t alignment = MAX(REAL_PAGE_SIZE, ZEND_MM_CHUNK_SIZE);
|
||||
size_t new_size = ZEND_MM_ALIGNED_SIZE_EX(size, MAX(REAL_PAGE_SIZE, ZEND_MM_CHUNK_SIZE));
|
||||
#else
|
||||
size_t alignment = REAL_PAGE_SIZE;
|
||||
size_t new_size = ZEND_MM_ALIGNED_SIZE_EX(size, REAL_PAGE_SIZE);
|
||||
#endif
|
||||
size_t new_size = ZEND_MM_ALIGNED_SIZE_EX(size, alignment);
|
||||
void *ptr;
|
||||
|
||||
if (UNEXPECTED(new_size < size)) {
|
||||
zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu + %zu)", size, alignment);
|
||||
}
|
||||
|
||||
#if ZEND_MM_LIMIT
|
||||
if (UNEXPECTED(new_size > heap->limit - heap->real_size)) {
|
||||
if (zend_mm_gc(heap) && new_size <= heap->limit - heap->real_size) {
|
||||
if (UNEXPECTED(heap->real_size + new_size > heap->limit)) {
|
||||
if (zend_mm_gc(heap) && heap->real_size + new_size <= heap->limit) {
|
||||
/* pass */
|
||||
} else if (heap->overflow == 0) {
|
||||
#if ZEND_DEBUG
|
||||
|
||||
+3
-10
@@ -995,11 +995,6 @@ static ZEND_COLD int zend_ast_valid_var_name(const char *s, size_t len)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static ZEND_COLD int zend_ast_var_needs_braces(char ch)
|
||||
{
|
||||
return ch == '[' || zend_ast_valid_var_char(ch);
|
||||
}
|
||||
|
||||
static ZEND_COLD void zend_ast_export_var(smart_str *str, zend_ast *ast, int priority, int indent)
|
||||
{
|
||||
if (ast->kind == ZEND_AST_ZVAL) {
|
||||
@@ -1047,7 +1042,7 @@ static ZEND_COLD void zend_ast_export_encaps_list(smart_str *str, char quote, ze
|
||||
ast->child[0]->kind == ZEND_AST_ZVAL &&
|
||||
(i + 1 == list->children ||
|
||||
list->child[i + 1]->kind != ZEND_AST_ZVAL ||
|
||||
!zend_ast_var_needs_braces(
|
||||
!zend_ast_valid_var_char(
|
||||
*Z_STRVAL_P(
|
||||
zend_ast_get_zval(list->child[i + 1]))))) {
|
||||
zend_ast_export_ex(str, ast, 0, indent);
|
||||
@@ -1158,7 +1153,7 @@ tail_call:
|
||||
} else {
|
||||
zend_ast_export_indent(str, indent);
|
||||
smart_str_appends(str, "} else ");
|
||||
if (ast->child[1] && ast->child[1]->kind == ZEND_AST_IF) {
|
||||
if (ast->child[1]->kind == ZEND_AST_IF) {
|
||||
list = (zend_ast_list*)ast->child[1];
|
||||
goto tail_call;
|
||||
} else {
|
||||
@@ -1463,7 +1458,7 @@ simple_list:
|
||||
}
|
||||
break;
|
||||
case ZEND_AST_TYPE:
|
||||
switch (ast->attr & ~ZEND_TYPE_NULLABLE) {
|
||||
switch (ast->attr) {
|
||||
case IS_ARRAY: APPEND_STR("array");
|
||||
case IS_CALLABLE: APPEND_STR("callable");
|
||||
EMPTY_SWITCH_DEFAULT_CASE();
|
||||
@@ -1664,8 +1659,6 @@ simple_list:
|
||||
zend_ast_export_ex(str, ast->child[1], 80, indent);
|
||||
smart_str_appends(str, " => ");
|
||||
}
|
||||
if (ast->attr)
|
||||
smart_str_appendc(str, '&');
|
||||
zend_ast_export_ex(str, ast->child[0], 80, indent);
|
||||
break;
|
||||
case ZEND_AST_NEW:
|
||||
|
||||
+2
-10
@@ -200,7 +200,7 @@ ZEND_METHOD(Closure, bind)
|
||||
ce = closure->func.common.scope;
|
||||
} else if ((ce = zend_lookup_class_ex(class_name, NULL, 1)) == NULL) {
|
||||
zend_error(E_WARNING, "Class '%s' not found", ZSTR_VAL(class_name));
|
||||
zend_tmp_string_release(tmp_class_name);
|
||||
zend_string_release_ex(class_name, 0);
|
||||
RETURN_NULL();
|
||||
}
|
||||
zend_tmp_string_release(tmp_class_name);
|
||||
@@ -268,16 +268,8 @@ static int zend_create_closure_from_callable(zval *return_value, zval *callable,
|
||||
|
||||
mptr = fcc.function_handler;
|
||||
if (mptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
|
||||
/* For Closure::fromCallable([$closure, "__invoke"]) return $closure. */
|
||||
if (fcc.object && fcc.object->ce == zend_ce_closure
|
||||
&& zend_string_equals_literal(mptr->common.function_name, "__invoke")) {
|
||||
ZVAL_OBJ(return_value, fcc.object);
|
||||
GC_ADDREF(fcc.object);
|
||||
zend_free_trampoline(mptr);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
memset(&call, 0, sizeof(zend_internal_function));
|
||||
|
||||
call.type = ZEND_INTERNAL_FUNCTION;
|
||||
call.fn_flags = mptr->common.fn_flags & ZEND_ACC_STATIC;
|
||||
call.handler = zend_closure_call_magic;
|
||||
|
||||
+15
-26
@@ -1693,17 +1693,13 @@ ZEND_API void zend_activate_auto_globals(void) /* {{{ */
|
||||
int ZEND_FASTCALL zendlex(zend_parser_stack_elem *elem) /* {{{ */
|
||||
{
|
||||
zval zv;
|
||||
int ret;
|
||||
|
||||
if (CG(increment_lineno)) {
|
||||
CG(zend_lineno)++;
|
||||
CG(increment_lineno) = 0;
|
||||
}
|
||||
|
||||
ret = lex_scan(&zv, elem);
|
||||
ZEND_ASSERT(!EG(exception) || ret == T_ERROR);
|
||||
return ret;
|
||||
|
||||
return lex_scan(&zv, elem);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -6698,7 +6694,6 @@ void zend_compile_use(zend_ast *ast) /* {{{ */
|
||||
}
|
||||
|
||||
zend_string_addref(old_name);
|
||||
old_name = zend_new_interned_string(old_name);
|
||||
if (!zend_hash_add_ptr(current_import, lookup_name, old_name)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use%s %s as %s because the name "
|
||||
"is already in use", zend_get_use_type_str(type), ZSTR_VAL(old_name), ZSTR_VAL(new_name));
|
||||
@@ -7768,9 +7763,6 @@ void zend_compile_const(znode *result, zend_ast *ast) /* {{{ */
|
||||
|
||||
while (last && last->kind == ZEND_AST_STMT_LIST) {
|
||||
zend_ast_list *list = zend_ast_get_list(last);
|
||||
if (list->children == 0) {
|
||||
break;
|
||||
}
|
||||
last = list->child[list->children-1];
|
||||
}
|
||||
if (last && last->kind == ZEND_AST_HALT_COMPILER) {
|
||||
@@ -8549,28 +8541,25 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
|
||||
case ZEND_AST_AND:
|
||||
case ZEND_AST_OR:
|
||||
{
|
||||
zend_bool child0_is_true, child1_is_true;
|
||||
zend_eval_const_expr(&ast->child[0]);
|
||||
zend_eval_const_expr(&ast->child[1]);
|
||||
if (ast->child[0]->kind != ZEND_AST_ZVAL) {
|
||||
int i;
|
||||
for (i = 0; i <= 1; i++) {
|
||||
zend_eval_const_expr(&ast->child[i]);
|
||||
if (ast->child[i]->kind == ZEND_AST_ZVAL) {
|
||||
if (zend_is_true(zend_ast_get_zval(ast->child[i])) == (ast->kind == ZEND_AST_OR)) {
|
||||
ZVAL_BOOL(&result, ast->kind == ZEND_AST_OR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ast->child[0]->kind != ZEND_AST_ZVAL || ast->child[1]->kind != ZEND_AST_ZVAL) {
|
||||
return;
|
||||
}
|
||||
|
||||
child0_is_true = zend_is_true(zend_ast_get_zval(ast->child[0]));
|
||||
if (child0_is_true == (ast->kind == ZEND_AST_OR)) {
|
||||
ZVAL_BOOL(&result, ast->kind == ZEND_AST_OR);
|
||||
break;
|
||||
}
|
||||
|
||||
if (ast->child[1]->kind != ZEND_AST_ZVAL) {
|
||||
return;
|
||||
}
|
||||
|
||||
child1_is_true = zend_is_true(zend_ast_get_zval(ast->child[1]));
|
||||
if (ast->kind == ZEND_AST_OR) {
|
||||
ZVAL_BOOL(&result, child0_is_true || child1_is_true);
|
||||
ZVAL_BOOL(&result, zend_is_true(zend_ast_get_zval(ast->child[0])) || zend_is_true(zend_ast_get_zval(ast->child[1])));
|
||||
} else {
|
||||
ZVAL_BOOL(&result, child0_is_true && child1_is_true);
|
||||
ZVAL_BOOL(&result, zend_is_true(zend_ast_get_zval(ast->child[0])) && zend_is_true(zend_ast_get_zval(ast->child[1])));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+21
-11
@@ -836,7 +836,6 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
|
||||
zend_string *lc_name;
|
||||
zend_fcall_info fcall_info;
|
||||
zend_fcall_info_cache fcall_cache;
|
||||
zend_class_entry *orig_fake_scope;
|
||||
|
||||
if (key) {
|
||||
lc_name = Z_STR_P(key);
|
||||
@@ -923,14 +922,11 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
|
||||
fcall_cache.called_scope = NULL;
|
||||
fcall_cache.object = NULL;
|
||||
|
||||
orig_fake_scope = EG(fake_scope);
|
||||
EG(fake_scope) = NULL;
|
||||
zend_exception_save();
|
||||
if ((zend_call_function(&fcall_info, &fcall_cache) == SUCCESS) && !EG(exception)) {
|
||||
ce = zend_hash_find_ptr(EG(class_table), lc_name);
|
||||
}
|
||||
zend_exception_restore();
|
||||
EG(fake_scope) = orig_fake_scope;
|
||||
|
||||
zval_ptr_dtor(&args[0]);
|
||||
zval_ptr_dtor_str(&fcall_info.function_name);
|
||||
@@ -1363,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;
|
||||
}
|
||||
|
||||
+33
-63
@@ -86,22 +86,6 @@
|
||||
#define GC_GREY 0x200000
|
||||
#define GC_PURPLE 0x300000
|
||||
|
||||
/* Debug tracing */
|
||||
#if ZEND_GC_DEBUG > 1
|
||||
# define GC_TRACE(format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__);
|
||||
# define GC_TRACE_REF(ref, format, ...) \
|
||||
do { \
|
||||
gc_trace_ref((zend_refcounted *) ref); \
|
||||
fprintf(stderr, format "\n", ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
# define GC_TRACE_SET_COLOR(ref, color) \
|
||||
GC_TRACE_REF(ref, "->%s", gc_color_name(color))
|
||||
#else
|
||||
# define GC_TRACE_REF(ref, format, ...)
|
||||
# define GC_TRACE_SET_COLOR(ref, new_color)
|
||||
# define GC_TRACE(str)
|
||||
#endif
|
||||
|
||||
/* GC_INFO access */
|
||||
#define GC_REF_ADDRESS(ref) \
|
||||
(((GC_TYPE_INFO(ref)) & (GC_ADDRESS << GC_INFO_SHIFT)) >> GC_INFO_SHIFT)
|
||||
@@ -119,19 +103,16 @@
|
||||
} while (0)
|
||||
|
||||
#define GC_REF_SET_COLOR(ref, c) do { \
|
||||
GC_TRACE_SET_COLOR(ref, c); \
|
||||
GC_TYPE_INFO(ref) = \
|
||||
(GC_TYPE_INFO(ref) & ~(GC_COLOR << GC_INFO_SHIFT)) | \
|
||||
((c) << GC_INFO_SHIFT); \
|
||||
} while (0)
|
||||
|
||||
#define GC_REF_SET_BLACK(ref) do { \
|
||||
GC_TRACE_SET_COLOR(ref, GC_BLACK); \
|
||||
GC_TYPE_INFO(ref) &= ~(GC_COLOR << GC_INFO_SHIFT); \
|
||||
} while (0)
|
||||
|
||||
#define GC_REF_SET_PURPLE(ref) do { \
|
||||
GC_TRACE_SET_COLOR(ref, GC_PURPLE); \
|
||||
GC_TYPE_INFO(ref) |= (GC_COLOR << GC_INFO_SHIFT); \
|
||||
} while (0)
|
||||
|
||||
@@ -169,7 +150,7 @@
|
||||
#define GC_DEFAULT_BUF_SIZE (16 * 1024)
|
||||
#define GC_BUF_GROW_STEP (128 * 1024)
|
||||
|
||||
#define GC_MAX_UNCOMPRESSED (512 * 1024)
|
||||
#define GC_MAX_UNCOMPRESSED (1024 * 1024)
|
||||
#define GC_MAX_BUF_SIZE 0x40000000
|
||||
|
||||
#define GC_THRESHOLD_DEFAULT 10000
|
||||
@@ -249,6 +230,21 @@ static zend_gc_globals gc_globals;
|
||||
# define GC_BENCH_PEAK(peak, counter)
|
||||
#endif
|
||||
|
||||
#if ZEND_GC_DEBUG > 1
|
||||
# define GC_TRACE(format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__);
|
||||
# define GC_TRACE_REF(ref, format, ...) \
|
||||
do { \
|
||||
gc_trace_ref((zend_refcounted *) ref); \
|
||||
fprintf(stderr, format "\n", ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
# define GC_TRACE_SET_COLOR(ref, color) \
|
||||
GC_TRACE_REF(ref, "->%s", gc_color_name(color))
|
||||
#else
|
||||
# define GC_TRACE_REF(ref, format, ...)
|
||||
# define GC_TRACE_SET_COLOR(ref, new_color)
|
||||
# define GC_TRACE(str)
|
||||
#endif
|
||||
|
||||
|
||||
#define GC_STACK_SEGMENT_SIZE (((4096 - ZEND_MM_OVERHEAD) / sizeof(void*)) - 2)
|
||||
|
||||
@@ -318,10 +314,7 @@ static void gc_stack_free(gc_stack *stack)
|
||||
|
||||
static zend_always_inline uint32_t gc_compress(uint32_t idx)
|
||||
{
|
||||
if (EXPECTED(idx < GC_MAX_UNCOMPRESSED)) {
|
||||
return idx;
|
||||
}
|
||||
return (idx % GC_MAX_UNCOMPRESSED) | GC_MAX_UNCOMPRESSED;
|
||||
return idx % GC_MAX_UNCOMPRESSED;
|
||||
}
|
||||
|
||||
static zend_always_inline gc_root_buffer* gc_decompress(zend_refcounted *ref, uint32_t idx)
|
||||
@@ -701,14 +694,11 @@ tail_call:
|
||||
ZVAL_OBJ(&tmp, obj);
|
||||
ht = get_gc(&tmp, &zv, &n);
|
||||
end = zv + n;
|
||||
if (EXPECTED(!ht) || UNEXPECTED(GC_REF_CHECK_COLOR(ht, GC_BLACK))) {
|
||||
ht = NULL;
|
||||
if (EXPECTED(!ht)) {
|
||||
if (!n) goto next;
|
||||
while (!Z_REFCOUNTED_P(--end)) {
|
||||
if (zv == end) goto next;
|
||||
}
|
||||
} else {
|
||||
GC_REF_SET_BLACK(ht);
|
||||
}
|
||||
while (zv != end) {
|
||||
if (Z_REFCOUNTED_P(zv)) {
|
||||
@@ -823,19 +813,15 @@ static void gc_mark_grey(zend_refcounted *ref, gc_stack *stack)
|
||||
ZVAL_OBJ(&tmp, obj);
|
||||
ht = get_gc(&tmp, &zv, &n);
|
||||
end = zv + n;
|
||||
if (EXPECTED(!ht) || UNEXPECTED(GC_REF_CHECK_COLOR(ht, GC_GREY))) {
|
||||
ht = NULL;
|
||||
if (EXPECTED(!ht)) {
|
||||
if (!n) goto next;
|
||||
while (!Z_REFCOUNTED_P(--end)) {
|
||||
if (zv == end) goto next;
|
||||
}
|
||||
} else {
|
||||
GC_REF_SET_COLOR(ht, GC_GREY);
|
||||
}
|
||||
while (zv != end) {
|
||||
if (Z_REFCOUNTED_P(zv)) {
|
||||
ref = Z_COUNTED_P(zv);
|
||||
ZEND_ASSERT(GC_REFCOUNT(ref) > 0);
|
||||
GC_DELREF(ref);
|
||||
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
|
||||
GC_REF_SET_COLOR(ref, GC_GREY);
|
||||
@@ -846,7 +832,6 @@ static void gc_mark_grey(zend_refcounted *ref, gc_stack *stack)
|
||||
}
|
||||
if (EXPECTED(!ht)) {
|
||||
ref = Z_COUNTED_P(zv);
|
||||
ZEND_ASSERT(GC_REFCOUNT(ref) > 0);
|
||||
GC_DELREF(ref);
|
||||
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
|
||||
GC_REF_SET_COLOR(ref, GC_GREY);
|
||||
@@ -867,7 +852,6 @@ static void gc_mark_grey(zend_refcounted *ref, gc_stack *stack)
|
||||
} else if (GC_TYPE(ref) == IS_REFERENCE) {
|
||||
if (Z_REFCOUNTED(((zend_reference*)ref)->val)) {
|
||||
ref = Z_COUNTED(((zend_reference*)ref)->val);
|
||||
ZEND_ASSERT(GC_REFCOUNT(ref) > 0);
|
||||
GC_DELREF(ref);
|
||||
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
|
||||
GC_REF_SET_COLOR(ref, GC_GREY);
|
||||
@@ -900,7 +884,6 @@ static void gc_mark_grey(zend_refcounted *ref, gc_stack *stack)
|
||||
}
|
||||
if (Z_REFCOUNTED_P(zv)) {
|
||||
ref = Z_COUNTED_P(zv);
|
||||
ZEND_ASSERT(GC_REFCOUNT(ref) > 0);
|
||||
GC_DELREF(ref);
|
||||
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
|
||||
GC_REF_SET_COLOR(ref, GC_GREY);
|
||||
@@ -914,7 +897,6 @@ static void gc_mark_grey(zend_refcounted *ref, gc_stack *stack)
|
||||
zv = Z_INDIRECT_P(zv);
|
||||
}
|
||||
ref = Z_COUNTED_P(zv);
|
||||
ZEND_ASSERT(GC_REFCOUNT(ref) > 0);
|
||||
GC_DELREF(ref);
|
||||
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
|
||||
GC_REF_SET_COLOR(ref, GC_GREY);
|
||||
@@ -1016,14 +998,11 @@ tail_call:
|
||||
ZVAL_OBJ(&tmp, obj);
|
||||
ht = get_gc(&tmp, &zv, &n);
|
||||
end = zv + n;
|
||||
if (EXPECTED(!ht) || UNEXPECTED(!GC_REF_CHECK_COLOR(ht, GC_GREY))) {
|
||||
ht = NULL;
|
||||
if (EXPECTED(!ht)) {
|
||||
if (!n) goto next;
|
||||
while (!Z_REFCOUNTED_P(--end)) {
|
||||
if (zv == end) goto next;
|
||||
}
|
||||
} else {
|
||||
GC_REF_SET_COLOR(ht, GC_WHITE);
|
||||
}
|
||||
while (zv != end) {
|
||||
if (Z_REFCOUNTED_P(zv)) {
|
||||
@@ -1190,8 +1169,7 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
|
||||
ZVAL_OBJ(&tmp, obj);
|
||||
ht = get_gc(&tmp, &zv, &n);
|
||||
end = zv + n;
|
||||
if (EXPECTED(!ht) || UNEXPECTED(GC_REF_CHECK_COLOR(ht, GC_BLACK))) {
|
||||
ht = NULL;
|
||||
if (EXPECTED(!ht)) {
|
||||
if (!n) goto next;
|
||||
while (!Z_REFCOUNTED_P(--end)) {
|
||||
/* count non-refcounted for compatibility ??? */
|
||||
@@ -1200,8 +1178,6 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
|
||||
}
|
||||
if (zv == end) goto next;
|
||||
}
|
||||
} else {
|
||||
GC_REF_SET_BLACK(ht);
|
||||
}
|
||||
while (zv != end) {
|
||||
if (Z_REFCOUNTED_P(zv)) {
|
||||
@@ -1350,24 +1326,16 @@ static void gc_remove_nested_data_from_buffer(zend_refcounted *ref, gc_root_buff
|
||||
zval *zv;
|
||||
|
||||
tail_call:
|
||||
do {
|
||||
if (root ||
|
||||
(GC_REF_ADDRESS(ref) != 0 &&
|
||||
GC_REF_CHECK_COLOR(ref, GC_BLACK))) {
|
||||
GC_TRACE_REF(ref, "removing from buffer");
|
||||
if (root) {
|
||||
GC_TRACE_REF(ref, "removing from buffer");
|
||||
gc_remove_from_roots(root);
|
||||
GC_REF_SET_INFO(ref, 0);
|
||||
root = NULL;
|
||||
} else if (GC_REF_ADDRESS(ref) != 0
|
||||
&& GC_REF_CHECK_COLOR(ref, GC_BLACK)) {
|
||||
GC_TRACE_REF(ref, "removing from buffer");
|
||||
GC_REMOVE_FROM_BUFFER(ref);
|
||||
} else if (GC_TYPE(ref) == IS_REFERENCE) {
|
||||
if (Z_REFCOUNTED(((zend_reference*)ref)->val)) {
|
||||
ref = Z_COUNTED(((zend_reference*)ref)->val);
|
||||
goto tail_call;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
return;
|
||||
GC_REMOVE_FROM_BUFFER(ref);
|
||||
}
|
||||
|
||||
if (GC_TYPE(ref) == IS_OBJECT) {
|
||||
@@ -1400,15 +1368,17 @@ tail_call:
|
||||
ref = Z_COUNTED_P(zv);
|
||||
goto tail_call;
|
||||
}
|
||||
if (GC_REF_ADDRESS(ht) != 0 && GC_REF_CHECK_COLOR(ht, GC_BLACK)) {
|
||||
GC_TRACE_REF(ht, "removing from buffer");
|
||||
GC_REMOVE_FROM_BUFFER(ht);
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else if (GC_TYPE(ref) == IS_ARRAY) {
|
||||
ht = (zend_array*)ref;
|
||||
} else if (GC_TYPE(ref) == IS_REFERENCE) {
|
||||
if (Z_REFCOUNTED(((zend_reference*)ref)->val)) {
|
||||
ref = Z_COUNTED(((zend_reference*)ref)->val);
|
||||
goto tail_call;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@@ -1444,7 +1414,7 @@ tail_call:
|
||||
}
|
||||
ref = Z_COUNTED_P(zv);
|
||||
goto tail_call;
|
||||
} while (0);
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API int zend_gc_collect_cycles(void)
|
||||
|
||||
+13
-18
@@ -96,18 +96,16 @@ ZEND_API zend_execute_data* zend_generator_freeze_call_stack(zend_execute_data *
|
||||
/* }}} */
|
||||
|
||||
static void zend_generator_cleanup_unfinished_execution(
|
||||
zend_generator *generator, zend_execute_data *execute_data, uint32_t catch_op_num) /* {{{ */
|
||||
zend_generator *generator, uint32_t catch_op_num) /* {{{ */
|
||||
{
|
||||
zend_execute_data *execute_data = generator->execute_data;
|
||||
|
||||
if (execute_data->opline != execute_data->func->op_array.opcodes) {
|
||||
/* -1 required because we want the last run opcode, not the next to-be-run one. */
|
||||
uint32_t op_num = execute_data->opline - execute_data->func->op_array.opcodes - 1;
|
||||
|
||||
if (UNEXPECTED(generator->frozen_call_stack)) {
|
||||
/* Temporarily restore generator->execute_data if it has been NULLed out already. */
|
||||
zend_execute_data *save_ex = generator->execute_data;
|
||||
generator->execute_data = execute_data;
|
||||
zend_generator_restore_call_stack(generator);
|
||||
generator->execute_data = save_ex;
|
||||
}
|
||||
zend_cleanup_unfinished_execution(execute_data, op_num, catch_op_num);
|
||||
}
|
||||
@@ -118,9 +116,6 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
|
||||
{
|
||||
if (EXPECTED(generator->execute_data)) {
|
||||
zend_execute_data *execute_data = generator->execute_data;
|
||||
/* Null out execute_data early, to prevent double frees if GC runs while we're
|
||||
* already cleaning up execute_data. */
|
||||
generator->execute_data = NULL;
|
||||
|
||||
if (EX_CALL_INFO() & ZEND_CALL_HAS_SYMBOL_TABLE) {
|
||||
zend_clean_and_cache_symbol_table(execute_data->symbol_table);
|
||||
@@ -139,12 +134,12 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
|
||||
return;
|
||||
}
|
||||
|
||||
zend_vm_stack_free_extra_args(execute_data);
|
||||
zend_vm_stack_free_extra_args(generator->execute_data);
|
||||
|
||||
/* Some cleanups are only necessary if the generator was closed
|
||||
* before it could finish execution (reach a return statement). */
|
||||
if (UNEXPECTED(!finished_execution)) {
|
||||
zend_generator_cleanup_unfinished_execution(generator, execute_data, 0);
|
||||
zend_generator_cleanup_unfinished_execution(generator, 0);
|
||||
}
|
||||
|
||||
/* Free closure object */
|
||||
@@ -158,7 +153,8 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
|
||||
generator->gc_buffer = NULL;
|
||||
}
|
||||
|
||||
efree(execute_data);
|
||||
efree(generator->execute_data);
|
||||
generator->execute_data = NULL;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -219,7 +215,7 @@ static void zend_generator_dtor_storage(zend_object *object) /* {{{ */
|
||||
if (finally_op_num) {
|
||||
zval *fast_call;
|
||||
|
||||
zend_generator_cleanup_unfinished_execution(generator, ex, finally_op_num);
|
||||
zend_generator_cleanup_unfinished_execution(generator, finally_op_num);
|
||||
|
||||
fast_call = ZEND_CALL_VAR(ex, ex->func->op_array.opcodes[finally_op_end].op1.var);
|
||||
Z_OBJ_P(fast_call) = EG(exception);
|
||||
@@ -275,7 +271,7 @@ static uint32_t calc_gc_buffer_size(zend_generator *generator) /* {{{ */
|
||||
if (EX_CALL_INFO() & ZEND_CALL_FREE_EXTRA_ARGS) {
|
||||
size += EX_NUM_ARGS() - op_array->num_args;
|
||||
}
|
||||
size += (EX_CALL_INFO() & ZEND_CALL_RELEASE_THIS) != 0; /* $this */
|
||||
size += Z_TYPE(execute_data->This) == IS_OBJECT; /* $this */
|
||||
size += (EX_CALL_INFO() & ZEND_CALL_CLOSURE) != 0; /* Closure object */
|
||||
|
||||
/* Live vars */
|
||||
@@ -356,7 +352,7 @@ static HashTable *zend_generator_get_gc(zval *object, zval **table, int *n) /* {
|
||||
}
|
||||
}
|
||||
|
||||
if (EX_CALL_INFO() & ZEND_CALL_RELEASE_THIS) {
|
||||
if (Z_TYPE(execute_data->This) == IS_OBJECT) {
|
||||
ZVAL_OBJ(gc_buffer++, Z_OBJ(execute_data->This));
|
||||
}
|
||||
if (EX_CALL_INFO() & ZEND_CALL_CLOSURE) {
|
||||
@@ -827,10 +823,9 @@ try_again:
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
if (generator == orig_generator) {
|
||||
zend_generator_close(generator, 0);
|
||||
if (!EG(current_execute_data)) {
|
||||
zend_throw_exception_internal(NULL);
|
||||
} else if (EG(current_execute_data)->func &&
|
||||
ZEND_USER_CODE(EG(current_execute_data)->func->common.type)) {
|
||||
if (EG(current_execute_data) &&
|
||||
EG(current_execute_data)->func &&
|
||||
ZEND_USER_CODE(EG(current_execute_data)->func->common.type)) {
|
||||
zend_rethrow_exception(EG(current_execute_data));
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1595,14 +1595,10 @@ static void zend_do_traits_property_binding(zend_class_entry *ce) /* {{{ */
|
||||
/* next: check for conflicts with current class */
|
||||
if ((coliding_prop = zend_hash_find_ptr(&ce->properties_info, prop_name)) != NULL) {
|
||||
if (coliding_prop->flags & ZEND_ACC_SHADOW) {
|
||||
/* Only free if shadow is coming from direct parent,
|
||||
* otherwise these weren't copied in the first place. */
|
||||
if (coliding_prop->ce == ce->parent) {
|
||||
zend_string_release_ex(coliding_prop->name, 0);
|
||||
if (coliding_prop->doc_comment) {
|
||||
zend_string_release_ex(coliding_prop->doc_comment, 0);
|
||||
}
|
||||
}
|
||||
zend_string_release_ex(coliding_prop->name, 0);
|
||||
if (coliding_prop->doc_comment) {
|
||||
zend_string_release_ex(coliding_prop->doc_comment, 0);
|
||||
}
|
||||
zend_hash_del(&ce->properties_info, prop_name);
|
||||
flags |= ZEND_ACC_CHANGED;
|
||||
} else {
|
||||
|
||||
@@ -310,7 +310,7 @@ static void zval_ini_dtor(zval *zv)
|
||||
%left '|' '&' '^'
|
||||
%right '~' '!'
|
||||
|
||||
%destructor { zval_ini_dtor(&$$); } TC_RAW TC_CONSTANT TC_NUMBER TC_STRING TC_WHITESPACE TC_LABEL TC_OFFSET TC_VARNAME BOOL_TRUE BOOL_FALSE NULL_NULL cfg_var_ref constant_literal constant_string encapsed_list expr option_offset section_string_or_value string_or_value var_string_list var_string_list_section
|
||||
%destructor { zval_ini_dtor(&$$); } TC_RAW TC_CONSTANT TC_NUMBER TC_STRING TC_WHITESPACE TC_LABEL TC_OFFSET TC_VARNAME BOOL_TRUE BOOL_FALSE NULL_NULL
|
||||
|
||||
%%
|
||||
|
||||
|
||||
@@ -1312,7 +1312,7 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
|
||||
|
||||
if (LANG_SCNG(yy_text)[0] == 0 &&
|
||||
LANG_SCNG(yy_leng) == 1 &&
|
||||
strcmp(yystr, "\"end of file\"") == 0) {
|
||||
memcmp(yystr, "\"end of file\"", sizeof("\"end of file\"") - 1) == 0) {
|
||||
if (yyres) {
|
||||
yystpcpy(yyres, "end of file");
|
||||
}
|
||||
|
||||
+354
-374
File diff suppressed because it is too large.
Load diff
@@ -115,7 +115,6 @@ do { \
|
||||
#define GET_DOUBLE_QUOTES_SCANNED_LENGTH() SCNG(scanned_string_len)
|
||||
|
||||
#define IS_LABEL_START(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z') || (c) == '_' || (c) >= 0x80)
|
||||
#define IS_LABEL_SUCCESSOR(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z') || ((c) >= '0' && (c) <= '9') || (c) == '_' || (c) >= 0x80)
|
||||
|
||||
#define ZEND_IS_OCT(c) ((c)>='0' && (c)<='7')
|
||||
#define ZEND_IS_HEX(c) (((c)>='0' && (c)<='9') || ((c)>='a' && (c)<='f') || ((c)>='A' && (c)<='F'))
|
||||
@@ -2098,7 +2097,7 @@ inline_char_handler:
|
||||
|
||||
if (YYCURSOR < YYLIMIT) {
|
||||
YYCURSOR++;
|
||||
} else if (!SCNG(heredoc_scan_ahead)) {
|
||||
} else {
|
||||
zend_error(E_COMPILE_WARNING, "Unterminated comment starting line %d", CG(zend_lineno));
|
||||
}
|
||||
|
||||
@@ -2320,12 +2319,9 @@ skip_escape_conversion:
|
||||
|
||||
/* Check for ending label on the next line */
|
||||
if (heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, heredoc_label->length)) {
|
||||
if (!IS_LABEL_SUCCESSOR(YYCURSOR[heredoc_label->length])) {
|
||||
if (!IS_LABEL_START(YYCURSOR[heredoc_label->length])) {
|
||||
if (spacing == (HEREDOC_USING_SPACES | HEREDOC_USING_TABS)) {
|
||||
zend_throw_exception(zend_ce_parse_error, "Invalid indentation - tabs and spaces cannot be mixed", 0);
|
||||
if (PARSER_MODE()) {
|
||||
RETURN_TOKEN(T_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
YYCURSOR = saved_cursor;
|
||||
@@ -2342,7 +2338,6 @@ skip_escape_conversion:
|
||||
zend_lex_state current_state;
|
||||
int heredoc_nesting_level = 1;
|
||||
int first_token = 0;
|
||||
int error = 0;
|
||||
|
||||
zend_save_lexical_state(¤t_state);
|
||||
|
||||
@@ -2390,7 +2385,6 @@ skip_escape_conversion:
|
||||
|| first_token == T_CURLY_OPEN
|
||||
) && SCNG(heredoc_indentation)) {
|
||||
zend_throw_exception_ex(zend_ce_parse_error, 0, "Invalid body indentation level (expecting an indentation level of at least %d)", SCNG(heredoc_indentation));
|
||||
error = 1;
|
||||
}
|
||||
|
||||
heredoc_label->indentation = SCNG(heredoc_indentation);
|
||||
@@ -2399,10 +2393,6 @@ skip_escape_conversion:
|
||||
zend_restore_lexical_state(¤t_state);
|
||||
SCNG(heredoc_scan_ahead) = 0;
|
||||
CG(increment_lineno) = 0;
|
||||
|
||||
if (PARSER_MODE() && error) {
|
||||
RETURN_TOKEN(T_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TOKEN(T_START_HEREDOC);
|
||||
@@ -2586,15 +2576,12 @@ double_quotes_scan_done:
|
||||
|
||||
/* Check for ending label on the next line */
|
||||
if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) {
|
||||
if (IS_LABEL_SUCCESSOR(YYCURSOR[heredoc_label->length])) {
|
||||
if (IS_LABEL_START(YYCURSOR[heredoc_label->length])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (spacing == (HEREDOC_USING_SPACES | HEREDOC_USING_TABS)) {
|
||||
zend_throw_exception(zend_ce_parse_error, "Invalid indentation - tabs and spaces cannot be mixed", 0);
|
||||
if (PARSER_MODE()) {
|
||||
RETURN_TOKEN(T_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/* newline before label will be subtracted from returned text, but
|
||||
@@ -2710,15 +2697,12 @@ heredoc_scan_done:
|
||||
|
||||
/* Check for ending label on the next line */
|
||||
if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) {
|
||||
if (IS_LABEL_SUCCESSOR(YYCURSOR[heredoc_label->length])) {
|
||||
if (IS_LABEL_START(YYCURSOR[heredoc_label->length])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (spacing == (HEREDOC_USING_SPACES | HEREDOC_USING_TABS)) {
|
||||
zend_throw_exception(zend_ce_parse_error, "Invalid indentation - tabs and spaces cannot be mixed", 0);
|
||||
if (PARSER_MODE()) {
|
||||
RETURN_TOKEN(T_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/* newline before label will be subtracted from returned text, but
|
||||
@@ -2767,9 +2751,7 @@ nowdoc_scan_done:
|
||||
RETURN_TOKEN(END);
|
||||
}
|
||||
|
||||
if (!SCNG(heredoc_scan_ahead)) {
|
||||
zend_error(E_COMPILE_WARNING, "Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
|
||||
}
|
||||
zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
|
||||
goto restart;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,11 +124,6 @@ ZEND_API HashTable *zend_std_get_gc(zval *object, zval **table, int *n) /* {{{ *
|
||||
if (zobj->properties) {
|
||||
*table = NULL;
|
||||
*n = 0;
|
||||
if (UNEXPECTED(GC_REFCOUNT(zobj->properties) > 1)
|
||||
&& EXPECTED(!(GC_FLAGS(zobj->properties) & IS_ARRAY_IMMUTABLE))) {
|
||||
GC_DELREF(zobj->properties);
|
||||
zobj->properties = zend_array_dup(zobj->properties);
|
||||
}
|
||||
return zobj->properties;
|
||||
} else {
|
||||
*table = zobj->properties_table;
|
||||
|
||||
+1
-2
@@ -43,8 +43,7 @@ ZEND_API void zend_object_std_dtor(zend_object *object)
|
||||
|
||||
if (object->properties) {
|
||||
if (EXPECTED(!(GC_FLAGS(object->properties) & IS_ARRAY_IMMUTABLE))) {
|
||||
if (EXPECTED(GC_DELREF(object->properties) == 0)
|
||||
&& EXPECTED(GC_TYPE(object->properties) != IS_NULL)) {
|
||||
if (EXPECTED(GC_DELREF(object->properties) == 0)) {
|
||||
zend_array_destroy(object->properties);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -235,8 +235,7 @@ ZEND_API void destroy_zend_class(zval *zv)
|
||||
efree(ce->default_static_members_table);
|
||||
}
|
||||
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
|
||||
if (prop_info->ce == ce ||
|
||||
((prop_info->flags & ZEND_ACC_SHADOW) && prop_info->ce == ce->parent)) {
|
||||
if (prop_info->ce == ce || (prop_info->flags & ZEND_ACC_SHADOW)) {
|
||||
zend_string_release_ex(prop_info->name, 0);
|
||||
if (prop_info->doc_comment) {
|
||||
zend_string_release_ex(prop_info->doc_comment, 0);
|
||||
|
||||
@@ -1193,18 +1193,12 @@ ZEND_API int ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* {
|
||||
|
||||
if (EXPECTED(op1 != op2)) {
|
||||
if (Z_TYPE_P(op1) == IS_ARRAY) {
|
||||
if (op1 == result) {
|
||||
zval_ptr_dtor(result);
|
||||
}
|
||||
ZVAL_LONG(result, 0);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
op1 = zendi_convert_scalar_to_number(op1, &op1_copy, result, 0);
|
||||
}
|
||||
if (Z_TYPE_P(op2) == IS_ARRAY) {
|
||||
if (op1 == result) {
|
||||
zval_ptr_dtor(result);
|
||||
}
|
||||
ZVAL_LONG(result, 1L);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
@@ -1212,9 +1206,6 @@ ZEND_API int ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* {
|
||||
}
|
||||
} else {
|
||||
if (Z_TYPE_P(op1) == IS_ARRAY) {
|
||||
if (op1 == result) {
|
||||
zval_ptr_dtor(result);
|
||||
}
|
||||
ZVAL_LONG(result, 0);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
|
||||
@@ -90,10 +90,10 @@ ZEND_API const char* ZEND_FASTCALL zend_memnstr_ex(const char *haystack, const c
|
||||
ZEND_API const char* ZEND_FASTCALL zend_memnrstr_ex(const char *haystack, const char *needle, size_t needle_len, const char *end);
|
||||
|
||||
#if SIZEOF_ZEND_LONG == 4
|
||||
# define ZEND_DOUBLE_FITS_LONG(d) (!((d) > (double)ZEND_LONG_MAX || (d) < (double)ZEND_LONG_MIN))
|
||||
# define ZEND_DOUBLE_FITS_LONG(d) (!((d) > ZEND_LONG_MAX || (d) < ZEND_LONG_MIN))
|
||||
#else
|
||||
/* >= as (double)ZEND_LONG_MAX is outside signed range */
|
||||
# define ZEND_DOUBLE_FITS_LONG(d) (!((d) >= (double)ZEND_LONG_MAX || (d) < (double)ZEND_LONG_MIN))
|
||||
# define ZEND_DOUBLE_FITS_LONG(d) (!((d) >= ZEND_LONG_MAX || (d) < ZEND_LONG_MIN))
|
||||
#endif
|
||||
|
||||
#if ZEND_DVAL_TO_LVAL_CAST_OK
|
||||
|
||||
+5
-16
@@ -328,13 +328,13 @@ void zend_signal_activate(void)
|
||||
|
||||
SIGG(active) = 1;
|
||||
SIGG(depth) = 0;
|
||||
SIGG(check) = ZEND_DEBUG;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ zend_signal_deactivate
|
||||
* */
|
||||
void zend_signal_deactivate(void)
|
||||
{
|
||||
|
||||
if (SIGG(check)) {
|
||||
size_t x;
|
||||
struct sigaction sa;
|
||||
@@ -342,32 +342,21 @@ void zend_signal_deactivate(void)
|
||||
if (SIGG(depth) != 0) {
|
||||
zend_error(E_CORE_WARNING, "zend_signal: shutdown with non-zero blocking depth (%d)", SIGG(depth));
|
||||
}
|
||||
|
||||
/* did anyone steal our installed handler */
|
||||
for (x = 0; x < sizeof(zend_sigs) / sizeof(*zend_sigs); x++) {
|
||||
sigaction(zend_sigs[x], NULL, &sa);
|
||||
if (sa.sa_sigaction != zend_signal_handler_defer &&
|
||||
sa.sa_sigaction != (void *) SIG_IGN) {
|
||||
if (sa.sa_sigaction != zend_signal_handler_defer) {
|
||||
zend_error(E_CORE_WARNING, "zend_signal: handler was replaced for signal (%d) after startup", zend_sigs[x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* After active=0 is set, signal handlers will be called directly and other
|
||||
* state that is reset below will not be accessed. */
|
||||
*((volatile int *) &SIGG(active)) = 0;
|
||||
|
||||
SIGNAL_BEGIN_CRITICAL();
|
||||
SIGG(active) = 0;
|
||||
SIGG(running) = 0;
|
||||
SIGG(blocked) = 0;
|
||||
SIGG(depth) = 0;
|
||||
|
||||
/* If there are any queued signals because of a missed unblock, drop them. */
|
||||
if (SIGG(phead) && SIGG(ptail)) {
|
||||
SIGG(ptail)->next = SIGG(pavail);
|
||||
SIGG(pavail) = SIGG(phead);
|
||||
SIGG(phead) = NULL;
|
||||
SIGG(ptail) = NULL;
|
||||
}
|
||||
SIGNAL_END_CRITICAL();
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
+2
-18
@@ -89,8 +89,6 @@ static cwd_state main_cwd_state; /* True global */
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <direct.h>
|
||||
#include "zend_globals.h"
|
||||
#include "zend_globals_macros.h"
|
||||
#endif
|
||||
|
||||
#define CWD_STATE_COPY(d, s) \
|
||||
@@ -859,7 +857,6 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
|
||||
tmp = do_alloca(len+1, use_heap);
|
||||
memcpy(tmp, path, len+1);
|
||||
|
||||
retry:
|
||||
if(save &&
|
||||
!(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') &&
|
||||
(dataw.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
|
||||
@@ -907,21 +904,7 @@ retry:
|
||||
return (size_t)-1;
|
||||
}
|
||||
if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) {
|
||||
BY_HANDLE_FILE_INFORMATION fileInformation;
|
||||
|
||||
free_alloca(pbuffer, use_heap_large);
|
||||
if ((dataw.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) &&
|
||||
(dataw.dwReserved0 & ~IO_REPARSE_TAG_CLOUD_MASK) == IO_REPARSE_TAG_CLOUD &&
|
||||
EG(windows_version_info).dwMajorVersion >= 10 &&
|
||||
EG(windows_version_info).dwMinorVersion == 0 &&
|
||||
EG(windows_version_info).dwBuildNumber >= 18362 &&
|
||||
GetFileInformationByHandle(hLink, &fileInformation) &&
|
||||
!(fileInformation.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
|
||||
dataw.dwFileAttributes = fileInformation.dwFileAttributes;
|
||||
CloseHandle(hLink);
|
||||
(*ll)--;
|
||||
goto retry;
|
||||
}
|
||||
free_alloca(tmp, use_heap);
|
||||
CloseHandle(hLink);
|
||||
FREE_PATHW()
|
||||
@@ -1001,7 +984,8 @@ retry:
|
||||
}
|
||||
else if (pbuffer->ReparseTag == IO_REPARSE_TAG_DEDUP ||
|
||||
/* Starting with 1709. */
|
||||
(pbuffer->ReparseTag & ~IO_REPARSE_TAG_CLOUD_MASK) == IO_REPARSE_TAG_CLOUD ||
|
||||
(pbuffer->ReparseTag & IO_REPARSE_TAG_CLOUD_MASK) != 0 && 0x90001018L != pbuffer->ReparseTag ||
|
||||
IO_REPARSE_TAG_CLOUD == pbuffer->ReparseTag ||
|
||||
IO_REPARSE_TAG_ONEDRIVE == pbuffer->ReparseTag) {
|
||||
isabsolute = 1;
|
||||
substitutename = malloc((len + 1) * sizeof(char));
|
||||
|
||||
+21
-32
@@ -741,10 +741,8 @@ ZEND_VM_COLD_CONST_HANDLER(13, ZEND_BOOL_NOT, CONST|TMPVAR|CV, ANY)
|
||||
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
|
||||
ZVAL_FALSE(EX_VAR(opline->result.var));
|
||||
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
|
||||
/* The result and op1 can be the same cv zval */
|
||||
const uint32_t orig_val_type = Z_TYPE_INFO_P(val);
|
||||
ZVAL_TRUE(EX_VAR(opline->result.var));
|
||||
if (OP1_TYPE == IS_CV && UNEXPECTED(orig_val_type == IS_UNDEF)) {
|
||||
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
|
||||
SAVE_OPLINE();
|
||||
GET_OP1_UNDEF_CV(val, BP_VAR_R);
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
@@ -2398,9 +2396,9 @@ ZEND_VM_HOT_HELPER(zend_leave_helper, ANY, ANY)
|
||||
uint32_t call_info = EX_CALL_INFO();
|
||||
|
||||
if (EXPECTED((call_info & (ZEND_CALL_CODE|ZEND_CALL_TOP|ZEND_CALL_HAS_SYMBOL_TABLE|ZEND_CALL_FREE_EXTRA_ARGS|ZEND_CALL_ALLOCATED)) == 0)) {
|
||||
EG(current_execute_data) = EX(prev_execute_data);
|
||||
i_free_compiled_variables(execute_data);
|
||||
|
||||
EG(current_execute_data) = EX(prev_execute_data);
|
||||
if (UNEXPECTED(call_info & ZEND_CALL_RELEASE_THIS)) {
|
||||
zend_object *object = Z_OBJ(execute_data->This);
|
||||
#if 0
|
||||
@@ -2426,17 +2424,12 @@ ZEND_VM_HOT_HELPER(zend_leave_helper, ANY, ANY)
|
||||
LOAD_NEXT_OPLINE();
|
||||
ZEND_VM_LEAVE();
|
||||
} else if (EXPECTED((call_info & (ZEND_CALL_CODE|ZEND_CALL_TOP)) == 0)) {
|
||||
EG(current_execute_data) = EX(prev_execute_data);
|
||||
i_free_compiled_variables(execute_data);
|
||||
|
||||
if (UNEXPECTED(call_info & ZEND_CALL_HAS_SYMBOL_TABLE)) {
|
||||
zend_clean_and_cache_symbol_table(EX(symbol_table));
|
||||
}
|
||||
|
||||
/* Free extra args before releasing the closure,
|
||||
* as that may free the op_array. */
|
||||
zend_vm_stack_free_extra_args_ex(call_info, execute_data);
|
||||
|
||||
EG(current_execute_data) = EX(prev_execute_data);
|
||||
if (UNEXPECTED(call_info & ZEND_CALL_RELEASE_THIS)) {
|
||||
zend_object *object = Z_OBJ(execute_data->This);
|
||||
#if 0
|
||||
@@ -2452,6 +2445,7 @@ ZEND_VM_HOT_HELPER(zend_leave_helper, ANY, ANY)
|
||||
OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
|
||||
}
|
||||
|
||||
zend_vm_stack_free_extra_args_ex(call_info, execute_data);
|
||||
old_execute_data = execute_data;
|
||||
execute_data = EX(prev_execute_data);
|
||||
zend_vm_stack_free_call_frame_ex(call_info, old_execute_data);
|
||||
@@ -2481,7 +2475,6 @@ ZEND_VM_HOT_HELPER(zend_leave_helper, ANY, ANY)
|
||||
ZEND_VM_LEAVE();
|
||||
} else {
|
||||
if (EXPECTED((call_info & ZEND_CALL_CODE) == 0)) {
|
||||
EG(current_execute_data) = EX(prev_execute_data);
|
||||
i_free_compiled_variables(execute_data);
|
||||
if (UNEXPECTED(call_info & (ZEND_CALL_HAS_SYMBOL_TABLE|ZEND_CALL_FREE_EXTRA_ARGS))) {
|
||||
if (UNEXPECTED(call_info & ZEND_CALL_HAS_SYMBOL_TABLE)) {
|
||||
@@ -2489,6 +2482,7 @@ ZEND_VM_HOT_HELPER(zend_leave_helper, ANY, ANY)
|
||||
}
|
||||
zend_vm_stack_free_extra_args_ex(call_info, execute_data);
|
||||
}
|
||||
EG(current_execute_data) = EX(prev_execute_data);
|
||||
if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
|
||||
OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
|
||||
}
|
||||
@@ -3163,7 +3157,6 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR,
|
||||
ce = zend_fetch_class_by_name(Z_STR_P(RT_CONSTANT(opline, opline->op1)), RT_CONSTANT(opline, opline->op1) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
|
||||
if (UNEXPECTED(ce == NULL)) {
|
||||
ZEND_ASSERT(EG(exception));
|
||||
FREE_UNFETCHED_OP2();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
if (OP2_TYPE != IS_CONST) {
|
||||
@@ -3344,11 +3337,11 @@ ZEND_VM_C_LABEL(try_function_name):
|
||||
call = NULL;
|
||||
}
|
||||
|
||||
FREE_OP2();
|
||||
if (UNEXPECTED(!call)) {
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
FREE_OP2();
|
||||
if (OP2_TYPE & (IS_VAR|IS_TMP_VAR)) {
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
if (call) {
|
||||
@@ -3360,6 +3353,8 @@ ZEND_VM_C_LABEL(try_function_name):
|
||||
}
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
} else if (UNEXPECTED(!call)) {
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
call->prev_execute_data = EX(call);
|
||||
@@ -3860,10 +3855,6 @@ ZEND_VM_HOT_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
|
||||
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
|
||||
ZVAL_COPY_VALUE(return_value, retval_ptr);
|
||||
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
|
||||
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
|
||||
if (GC_MAY_LEAK(ref)) {
|
||||
gc_possible_root(ref);
|
||||
}
|
||||
ZVAL_NULL(retval_ptr);
|
||||
} else {
|
||||
Z_ADDREF_P(return_value);
|
||||
@@ -4850,10 +4841,8 @@ ZEND_VM_COLD_CONST_HANDLER(52, ZEND_BOOL, CONST|TMPVAR|CV, ANY)
|
||||
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
|
||||
ZVAL_TRUE(EX_VAR(opline->result.var));
|
||||
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
|
||||
/* The result and op1 can be the same cv zval */
|
||||
const uint32_t orig_val_type = Z_TYPE_INFO_P(val);
|
||||
ZVAL_FALSE(EX_VAR(opline->result.var));
|
||||
if (OP1_TYPE == IS_CV && UNEXPECTED(orig_val_type == IS_UNDEF)) {
|
||||
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
|
||||
SAVE_OPLINE();
|
||||
GET_OP1_UNDEF_CV(val, BP_VAR_R);
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
@@ -8517,7 +8506,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER_OR_EQUAL, (op1_info == MAY_BE_DOUB
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_INC, (res_info == MAY_BE_LONG && op1_info == MAY_BE_LONG), ZEND_PRE_INC_LONG_NO_OVERFLOW, CV, ANY, SPEC(RETVAL))
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_INC, (res_info == MAY_BE_LONG && op1_info == MAY_BE_LONG), ZEND_PRE_INC_LONG_NO_OVERFLOW, TMPVARCV, ANY, SPEC(RETVAL))
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *var_ptr;
|
||||
@@ -8530,7 +8519,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_INC, (res_info == MAY_BE_LONG && op1_info
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_INC, (op1_info == MAY_BE_LONG), ZEND_PRE_INC_LONG, CV, ANY, SPEC(RETVAL))
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_INC, (op1_info == MAY_BE_LONG), ZEND_PRE_INC_LONG, TMPVARCV, ANY, SPEC(RETVAL))
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *var_ptr;
|
||||
@@ -8543,7 +8532,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_INC, (op1_info == MAY_BE_LONG), ZEND_PRE_
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_INC, (op1_info == (MAY_BE_LONG|MAY_BE_DOUBLE)), ZEND_PRE_INC_LONG_OR_DOUBLE, CV, ANY, SPEC(RETVAL))
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_INC, (op1_info == (MAY_BE_LONG|MAY_BE_DOUBLE)), ZEND_PRE_INC_LONG_OR_DOUBLE, TMPVARCV, ANY, SPEC(RETVAL))
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *var_ptr;
|
||||
@@ -8560,7 +8549,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_INC, (op1_info == (MAY_BE_LONG|MAY_BE_DOU
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_DEC, (res_info == MAY_BE_LONG && op1_info == MAY_BE_LONG), ZEND_PRE_DEC_LONG_NO_OVERFLOW, CV, ANY, SPEC(RETVAL))
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_DEC, (res_info == MAY_BE_LONG && op1_info == MAY_BE_LONG), ZEND_PRE_DEC_LONG_NO_OVERFLOW, TMPVARCV, ANY, SPEC(RETVAL))
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *var_ptr;
|
||||
@@ -8573,7 +8562,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_DEC, (res_info == MAY_BE_LONG && op1_info
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_DEC, (op1_info == MAY_BE_LONG), ZEND_PRE_DEC_LONG, CV, ANY, SPEC(RETVAL))
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_DEC, (op1_info == MAY_BE_LONG), ZEND_PRE_DEC_LONG, TMPVARCV, ANY, SPEC(RETVAL))
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *var_ptr;
|
||||
@@ -8586,7 +8575,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_DEC, (op1_info == MAY_BE_LONG), ZEND_PRE_
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_DEC, (op1_info == (MAY_BE_LONG|MAY_BE_DOUBLE)), ZEND_PRE_DEC_LONG_OR_DOUBLE, CV, ANY, SPEC(RETVAL))
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_DEC, (op1_info == (MAY_BE_LONG|MAY_BE_DOUBLE)), ZEND_PRE_DEC_LONG_OR_DOUBLE, TMPVARCV, ANY, SPEC(RETVAL))
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *var_ptr;
|
||||
@@ -8603,7 +8592,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_DEC, (op1_info == (MAY_BE_LONG|MAY_BE_DOU
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_INC, (res_info == MAY_BE_LONG && op1_info == MAY_BE_LONG), ZEND_POST_INC_LONG_NO_OVERFLOW, CV, ANY)
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_INC, (res_info == MAY_BE_LONG && op1_info == MAY_BE_LONG), ZEND_POST_INC_LONG_NO_OVERFLOW, TMPVARCV, ANY)
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *var_ptr;
|
||||
@@ -8614,7 +8603,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_INC, (res_info == MAY_BE_LONG && op1_inf
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_INC, (op1_info == MAY_BE_LONG), ZEND_POST_INC_LONG, CV, ANY)
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_INC, (op1_info == MAY_BE_LONG), ZEND_POST_INC_LONG, TMPVARCV, ANY)
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *var_ptr;
|
||||
@@ -8625,7 +8614,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_INC, (op1_info == MAY_BE_LONG), ZEND_POS
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_INC, (op1_info == (MAY_BE_LONG|MAY_BE_DOUBLE)), ZEND_POST_INC_LONG_OR_DOUBLE, CV, ANY)
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_INC, (op1_info == (MAY_BE_LONG|MAY_BE_DOUBLE)), ZEND_POST_INC_LONG_OR_DOUBLE, TMPVARCV, ANY)
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *var_ptr;
|
||||
@@ -8641,7 +8630,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_INC, (op1_info == (MAY_BE_LONG|MAY_BE_DO
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_DEC, (res_info == MAY_BE_LONG && op1_info == MAY_BE_LONG), ZEND_POST_DEC_LONG_NO_OVERFLOW, CV, ANY)
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_DEC, (res_info == MAY_BE_LONG && op1_info == MAY_BE_LONG), ZEND_POST_DEC_LONG_NO_OVERFLOW, TMPVARCV, ANY)
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *var_ptr;
|
||||
@@ -8652,7 +8641,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_DEC, (res_info == MAY_BE_LONG && op1_inf
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_DEC, (op1_info == MAY_BE_LONG), ZEND_POST_DEC_LONG, CV, ANY)
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_DEC, (op1_info == MAY_BE_LONG), ZEND_POST_DEC_LONG, TMPVARCV, ANY)
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *var_ptr;
|
||||
@@ -8663,7 +8652,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_DEC, (op1_info == MAY_BE_LONG), ZEND_POS
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_DEC, (op1_info == (MAY_BE_LONG|MAY_BE_DOUBLE)), ZEND_POST_DEC_LONG_OR_DOUBLE, CV, ANY)
|
||||
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_DEC, (op1_info == (MAY_BE_LONG|MAY_BE_DOUBLE)), ZEND_POST_DEC_LONG_OR_DOUBLE, TMPVARCV, ANY)
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *var_ptr;
|
||||
|
||||
+377
-435
File diff suppressed because it is too large.
Load diff
@@ -321,7 +321,7 @@ $op1_get_zval_ptr_ptr_undef = array(
|
||||
"UNUSED" => "NULL",
|
||||
"CV" => "EX_VAR(opline->op1.var)",
|
||||
"TMPVAR" => "???",
|
||||
"TMPVARCV" => "???",
|
||||
"TMPVARCV" => "EX_VAR(opline->op1.var)",
|
||||
);
|
||||
|
||||
$op2_get_zval_ptr_ptr_undef = array(
|
||||
@@ -332,7 +332,7 @@ $op2_get_zval_ptr_ptr_undef = array(
|
||||
"UNUSED" => "NULL",
|
||||
"CV" => "EX_VAR(opline->op2.var)",
|
||||
"TMPVAR" => "???",
|
||||
"TMPVARCV" => "???",
|
||||
"TMPVARCV" => "EX_VAR(opline->op2.var)",
|
||||
);
|
||||
|
||||
$op1_get_obj_zval_ptr = array(
|
||||
@@ -431,7 +431,7 @@ $op1_get_obj_zval_ptr_ptr_undef = array(
|
||||
"UNUSED" => "&EX(This)",
|
||||
"CV" => "EX_VAR(opline->op1.var)",
|
||||
"TMPVAR" => "???",
|
||||
"TMPVARCV" => "???",
|
||||
"TMPVARCV" => "EX_VAR(opline->op1.var)",
|
||||
);
|
||||
|
||||
$op2_get_obj_zval_ptr_ptr_undef = array(
|
||||
@@ -442,7 +442,7 @@ $op2_get_obj_zval_ptr_ptr_undef = array(
|
||||
"UNUSED" => "&EX(This)",
|
||||
"CV" => "EX_VAR(opline->op2.var)",
|
||||
"TMPVAR" => "???",
|
||||
"TMPVARCV" => "???",
|
||||
"TMPVARCV" => "EX_VAR(opline->op2.var)",
|
||||
);
|
||||
|
||||
$op1_free_op = array(
|
||||
|
||||
+18
-18
@@ -2007,24 +2007,24 @@
|
||||
_(3850, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
|
||||
_(3851, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
|
||||
_(3852, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
|
||||
_(3853, ZEND_PRE_INC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_UNUSED) \
|
||||
_(3854, ZEND_PRE_INC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_USED) \
|
||||
_(3855, ZEND_PRE_INC_LONG_SPEC_CV_RETVAL_UNUSED) \
|
||||
_(3856, ZEND_PRE_INC_LONG_SPEC_CV_RETVAL_USED) \
|
||||
_(3857, ZEND_PRE_INC_LONG_OR_DOUBLE_SPEC_CV_RETVAL_UNUSED) \
|
||||
_(3858, ZEND_PRE_INC_LONG_OR_DOUBLE_SPEC_CV_RETVAL_USED) \
|
||||
_(3859, ZEND_PRE_DEC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_UNUSED) \
|
||||
_(3860, ZEND_PRE_DEC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_USED) \
|
||||
_(3861, ZEND_PRE_DEC_LONG_SPEC_CV_RETVAL_UNUSED) \
|
||||
_(3862, ZEND_PRE_DEC_LONG_SPEC_CV_RETVAL_USED) \
|
||||
_(3863, ZEND_PRE_DEC_LONG_OR_DOUBLE_SPEC_CV_RETVAL_UNUSED) \
|
||||
_(3864, ZEND_PRE_DEC_LONG_OR_DOUBLE_SPEC_CV_RETVAL_USED) \
|
||||
_(3865, ZEND_POST_INC_LONG_NO_OVERFLOW_SPEC_CV) \
|
||||
_(3866, ZEND_POST_INC_LONG_SPEC_CV) \
|
||||
_(3867, ZEND_POST_INC_LONG_OR_DOUBLE_SPEC_CV) \
|
||||
_(3868, ZEND_POST_DEC_LONG_NO_OVERFLOW_SPEC_CV) \
|
||||
_(3869, ZEND_POST_DEC_LONG_SPEC_CV) \
|
||||
_(3870, ZEND_POST_DEC_LONG_OR_DOUBLE_SPEC_CV) \
|
||||
_(3853, ZEND_PRE_INC_LONG_NO_OVERFLOW_SPEC_TMPVARCV_RETVAL_UNUSED) \
|
||||
_(3854, ZEND_PRE_INC_LONG_NO_OVERFLOW_SPEC_TMPVARCV_RETVAL_USED) \
|
||||
_(3855, ZEND_PRE_INC_LONG_SPEC_TMPVARCV_RETVAL_UNUSED) \
|
||||
_(3856, ZEND_PRE_INC_LONG_SPEC_TMPVARCV_RETVAL_USED) \
|
||||
_(3857, ZEND_PRE_INC_LONG_OR_DOUBLE_SPEC_TMPVARCV_RETVAL_UNUSED) \
|
||||
_(3858, ZEND_PRE_INC_LONG_OR_DOUBLE_SPEC_TMPVARCV_RETVAL_USED) \
|
||||
_(3859, ZEND_PRE_DEC_LONG_NO_OVERFLOW_SPEC_TMPVARCV_RETVAL_UNUSED) \
|
||||
_(3860, ZEND_PRE_DEC_LONG_NO_OVERFLOW_SPEC_TMPVARCV_RETVAL_USED) \
|
||||
_(3861, ZEND_PRE_DEC_LONG_SPEC_TMPVARCV_RETVAL_UNUSED) \
|
||||
_(3862, ZEND_PRE_DEC_LONG_SPEC_TMPVARCV_RETVAL_USED) \
|
||||
_(3863, ZEND_PRE_DEC_LONG_OR_DOUBLE_SPEC_TMPVARCV_RETVAL_UNUSED) \
|
||||
_(3864, ZEND_PRE_DEC_LONG_OR_DOUBLE_SPEC_TMPVARCV_RETVAL_USED) \
|
||||
_(3865, ZEND_POST_INC_LONG_NO_OVERFLOW_SPEC_TMPVARCV) \
|
||||
_(3866, ZEND_POST_INC_LONG_SPEC_TMPVARCV) \
|
||||
_(3867, ZEND_POST_INC_LONG_OR_DOUBLE_SPEC_TMPVARCV) \
|
||||
_(3868, ZEND_POST_DEC_LONG_NO_OVERFLOW_SPEC_TMPVARCV) \
|
||||
_(3869, ZEND_POST_DEC_LONG_SPEC_TMPVARCV) \
|
||||
_(3870, ZEND_POST_DEC_LONG_OR_DOUBLE_SPEC_TMPVARCV) \
|
||||
_(3871, ZEND_QM_ASSIGN_DOUBLE_SPEC_CONST) \
|
||||
_(3872, ZEND_QM_ASSIGN_DOUBLE_SPEC_TMPVARCV) \
|
||||
_(3873, ZEND_QM_ASSIGN_DOUBLE_SPEC_TMPVARCV) \
|
||||
|
||||
+2
-5
@@ -395,8 +395,6 @@ AC_DEFUN([PHP_EVAL_LIBLINE],[
|
||||
$2="[$]$2 -pthread"
|
||||
else
|
||||
PHP_RUN_ONCE(EXTRA_LDFLAGS, [$ac_i], [EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i"])
|
||||
PHP_RUN_ONCE(EXTRA_LDFLAGS_PROGRAM, [$ac_i],
|
||||
[EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $ac_i"])
|
||||
fi
|
||||
;;
|
||||
-l*[)]
|
||||
@@ -2181,7 +2179,7 @@ AC_DEFUN([PHP_SETUP_ICU],[
|
||||
|
||||
dnl If pkg-config is found try using it
|
||||
if test "$PHP_ICU_DIR" = "DEFAULT" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists icu-uc icu-io icu-i18n; then
|
||||
if $PKG_CONFIG --atleast-version=4.0 icu-uc; then
|
||||
if $PKG_CONFIG --atleast-version=40 icu-uc; then
|
||||
found_icu=yes
|
||||
icu_version_full=`$PKG_CONFIG --modversion icu-uc`
|
||||
ac_IFS=$IFS
|
||||
@@ -2193,8 +2191,7 @@ AC_DEFUN([PHP_SETUP_ICU],[
|
||||
|
||||
ICU_LIBS=`$PKG_CONFIG --libs icu-uc icu-io icu-i18n`
|
||||
ICU_INCS=`$PKG_CONFIG --cflags-only-I icu-uc icu-io icu-i18n`
|
||||
ICU_CXXFLAGS=`$PKG_CONFIG --variable=CXXFLAGS icu-uc`
|
||||
ICU_CXXFLAGS="$ICU_CXXFLAGS -DU_USING_ICU_NAMESPACE=1"
|
||||
ICU_CXXFLAGS="-DU_USING_ICU_NAMESPACE=1"
|
||||
|
||||
AC_MSG_RESULT([found $ICU_VERSION])
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
@echo off
|
||||
cscript /nologo /e:jscript win32\build\buildconf.js %*
|
||||
cscript /nologo win32\build\buildconf.js %*
|
||||
SET PHP_BUILDCONF_PATH=%~dp0
|
||||
copy %PHP_BUILDCONF_PATH%\win32\build\configure.bat %PHP_BUILDCONF_PATH% > nul
|
||||
SET PHP_SDK_SCRIPT_PATH=
|
||||
|
||||
+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=15
|
||||
PHP_EXTRA_VERSION=""
|
||||
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`
|
||||
|
||||
|
||||
@@ -57,9 +57,9 @@ bc_str2num (bc_num *num, char *str, int scale)
|
||||
zero_int = FALSE;
|
||||
if ( (*ptr == '+') || (*ptr == '-')) ptr++; /* Sign */
|
||||
while (*ptr == '0') ptr++; /* Skip leading zeros. */
|
||||
while (*ptr >= '0' && *ptr <= '9') ptr++, digits++; /* digits */
|
||||
while (isdigit((int)*ptr)) ptr++, digits++; /* digits */
|
||||
if (*ptr == '.') ptr++; /* decimal point */
|
||||
while (*ptr >= '0' && *ptr <= '9') ptr++, strscale++; /* digits */
|
||||
while (isdigit((int)*ptr)) ptr++, strscale++; /* digits */
|
||||
if ((*ptr != '\0') || (digits+strscale == 0))
|
||||
{
|
||||
*num = bc_copy_num (BCG(_zero_));
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78878 (Buffer underflow in bc_shift_addsub)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
print @bcmul("\xB26483605105519922841849335928742092", bcpowmod(2, 65535, -4e-4));
|
||||
?>
|
||||
--EXPECT--
|
||||
0
|
||||
@@ -2,8 +2,6 @@
|
||||
easter_date()
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--ENV--
|
||||
TZ=UTC
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
|
||||
@@ -123,11 +123,6 @@ static void com_write_dimension(zval *object, zval *offset, zval *value)
|
||||
|
||||
obj = CDNO_FETCH(object);
|
||||
|
||||
if (offset == NULL) {
|
||||
php_com_throw_exception(DISP_E_BADINDEX, "appending to variants is not supported");
|
||||
return;
|
||||
}
|
||||
|
||||
if (V_VT(&obj->v) == VT_DISPATCH) {
|
||||
ZVAL_COPY_VALUE(&args[0], offset);
|
||||
ZVAL_COPY_VALUE(&args[1], value);
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78694 (Appending to a variant array causes segfault)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
foreach ([new com('WScript.Shell'), new variant([])] as $var) {
|
||||
try {
|
||||
$var[] = 42;
|
||||
} catch (com_exception $ex) {
|
||||
var_dump($ex->getMessage());
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
string(38) "appending to variants is not supported"
|
||||
string(38) "appending to variants is not supported"
|
||||
+3
-59
@@ -150,6 +150,8 @@ static void _php_curl_close_ex(php_curl *ch);
|
||||
static void _php_curl_close(zend_resource *rsrc);
|
||||
|
||||
|
||||
#define SAVE_CURL_ERROR(__handle, __err) (__handle)->err.no = (int) __err;
|
||||
|
||||
#define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s) - 1, (zend_long) v);
|
||||
#define CAAD(s, v) add_assoc_double_ex(return_value, s, sizeof(s) - 1, (double) v);
|
||||
#define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s) - 1, (char *) (v ? v : ""));
|
||||
@@ -1452,10 +1454,6 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_TLS13_CIPHERS);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x074000 /* Available since 7.64.0 */
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_HTTP09_ALLOWED);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x074001 /* Available since 7.64.1 */
|
||||
REGISTER_CURL_CONSTANT(CURL_VERSION_ALTSVC);
|
||||
#endif
|
||||
@@ -1848,11 +1846,7 @@ static void curl_free_string(void **string)
|
||||
*/
|
||||
static void curl_free_post(void **post)
|
||||
{
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
|
||||
curl_mime_free((curl_mime *)*post);
|
||||
#else
|
||||
curl_formfree((struct HttpPost *)*post);
|
||||
#endif
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -2369,9 +2363,6 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x073d00 /* Available since 7.61.0 */
|
||||
case CURLOPT_DISALLOW_USERNAME_IN_URL:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x074000 /* Available since 7.64.0 */
|
||||
case CURLOPT_HTTP09_ALLOWED:
|
||||
#endif
|
||||
lval = zval_get_long(zvalue);
|
||||
#if LIBCURL_VERSION_NUM >= 0x071304
|
||||
@@ -2775,30 +2766,16 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
||||
HashTable *postfields;
|
||||
zend_string *string_key;
|
||||
zend_ulong num_key;
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
|
||||
curl_mime *mime = NULL;
|
||||
curl_mimepart *part;
|
||||
CURLcode form_error;
|
||||
#else
|
||||
struct HttpPost *first = NULL;
|
||||
struct HttpPost *last = NULL;
|
||||
CURLFORMcode form_error;
|
||||
#endif
|
||||
|
||||
postfields = HASH_OF(zvalue);
|
||||
if (!postfields) {
|
||||
php_error_docref(NULL, E_WARNING, "Couldn't get HashTable in CURLOPT_POSTFIELDS");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
|
||||
if (zend_hash_num_elements(postfields) > 0) {
|
||||
mime = curl_mime_init(ch->cp);
|
||||
if (mime == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ZEND_HASH_FOREACH_KEY_VAL(postfields, num_key, string_key, current) {
|
||||
zend_string *postval, *tmp_postval;
|
||||
/* Pretend we have a string_key here */
|
||||
@@ -2833,20 +2810,6 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
||||
if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) {
|
||||
filename = Z_STRVAL_P(prop);
|
||||
}
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
|
||||
part = curl_mime_addpart(mime);
|
||||
if (part == NULL) {
|
||||
zend_string_release_ex(string_key, 0);
|
||||
return FAILURE;
|
||||
}
|
||||
if ((form_error = curl_mime_name(part, ZSTR_VAL(string_key))) != CURLE_OK
|
||||
|| (form_error = curl_mime_filedata(part, ZSTR_VAL(postval))) != CURLE_OK
|
||||
|| (form_error = curl_mime_filename(part, filename ? filename : ZSTR_VAL(postval))) != CURLE_OK
|
||||
|| (form_error = curl_mime_type(part, type ? type : "application/octet-stream")) != CURLE_OK) {
|
||||
error = form_error;
|
||||
}
|
||||
#else
|
||||
form_error = curl_formadd(&first, &last,
|
||||
CURLFORM_COPYNAME, ZSTR_VAL(string_key),
|
||||
CURLFORM_NAMELENGTH, ZSTR_LEN(string_key),
|
||||
@@ -2858,7 +2821,6 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
||||
/* Not nice to convert between enums but we only have place for one error type */
|
||||
error = (CURLcode)form_error;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
zend_string_release_ex(string_key, 0);
|
||||
@@ -2867,18 +2829,6 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
||||
|
||||
postval = zval_get_tmp_string(current, &tmp_postval);
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
|
||||
part = curl_mime_addpart(mime);
|
||||
if (part == NULL) {
|
||||
zend_tmp_string_release(tmp_postval);
|
||||
zend_string_release_ex(string_key, 0);
|
||||
return FAILURE;
|
||||
}
|
||||
if ((form_error = curl_mime_name(part, ZSTR_VAL(string_key))) != CURLE_OK
|
||||
|| (form_error = curl_mime_data(part, ZSTR_VAL(postval), ZSTR_LEN(postval))) != CURLE_OK) {
|
||||
error = form_error;
|
||||
}
|
||||
#else
|
||||
/* The arguments after _NAMELENGTH and _CONTENTSLENGTH
|
||||
* must be explicitly cast to long in curl_formadd
|
||||
* use since curl needs a long not an int. */
|
||||
@@ -2893,7 +2843,6 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
||||
/* Not nice to convert between enums but we only have place for one error type */
|
||||
error = (CURLcode)form_error;
|
||||
}
|
||||
#endif
|
||||
zend_tmp_string_release(tmp_postval);
|
||||
zend_string_release_ex(string_key, 0);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
@@ -2906,13 +2855,8 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
|
||||
if ((*ch->clone) == 1) {
|
||||
zend_llist_clean(&ch->to_free->post);
|
||||
}
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
|
||||
zend_llist_add_element(&ch->to_free->post, &mime);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_MIMEPOST, mime);
|
||||
#else
|
||||
zend_llist_add_element(&ch->to_free->post, &first);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_HTTPPOST, first);
|
||||
#endif
|
||||
} else {
|
||||
#if LIBCURL_VERSION_NUM >= 0x071101
|
||||
zend_string *tmp_str;
|
||||
|
||||
@@ -92,8 +92,6 @@ PHP_FUNCTION(curl_multi_add_handle)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
_php_curl_verify_handlers(ch, 1);
|
||||
|
||||
_php_curl_cleanup_handle(ch);
|
||||
|
||||
GC_ADDREF(Z_RES_P(z_ch));
|
||||
@@ -336,7 +334,6 @@ PHP_FUNCTION(curl_multi_info_read)
|
||||
CURLMsg *tmp_msg;
|
||||
int queued_msgs;
|
||||
zval *zmsgs_in_queue = NULL;
|
||||
php_curl *ch;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_RESOURCE(z_mh)
|
||||
@@ -374,10 +371,6 @@ PHP_FUNCTION(curl_multi_info_read)
|
||||
being done in add_assoc_resource */
|
||||
Z_ADDREF_P(pz_ch);
|
||||
|
||||
/* we must save result to be able to read error message */
|
||||
ch = (php_curl*)zend_fetch_resource(Z_RES_P(pz_ch), le_curl_name, le_curl);
|
||||
SAVE_CURL_ERROR(ch, tmp_msg->data.result);
|
||||
|
||||
/* add_assoc_resource automatically creates a new zval to
|
||||
wrap the "resource" represented by the current pz_ch */
|
||||
|
||||
|
||||
@@ -58,8 +58,6 @@ extern zend_module_entry curl_module_entry;
|
||||
#define PHP_CURL_RETURN 4
|
||||
#define PHP_CURL_IGNORE 7
|
||||
|
||||
#define SAVE_CURL_ERROR(__handle, __err) (__handle)->err.no = (int) __err;
|
||||
|
||||
extern int le_curl;
|
||||
#define le_curl_name "cURL handle"
|
||||
extern int le_curl_multi_handle;
|
||||
|
||||
@@ -2,7 +2,12 @@
|
||||
Bug #45161 (Reusing a curl handle leaks memory)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include 'skipif.inc';
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
exit("skip not for Windows");
|
||||
}
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
$curl_version = curl_version();
|
||||
if ($curl_version['version_number'] < 0x071100) {
|
||||
exit("skip: test works only with curl >= 7.17.0");
|
||||
@@ -10,12 +15,10 @@ if ($curl_version['version_number'] < 0x071100) {
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
// Fill memory for test
|
||||
$ch = curl_init();
|
||||
$fp = fopen(PHP_OS_FAMILY === 'Windows' ? 'nul' : '/dev/null', 'w');
|
||||
$fp = fopen('/dev/null', 'w');
|
||||
|
||||
/*
|
||||
$i = $start = $end = 100000.00;
|
||||
@@ -29,7 +32,7 @@ for ($i = 0; $i < 100; $i++) {
|
||||
// Start actual test
|
||||
$start = memory_get_usage() + 1024;
|
||||
for($i = 0; $i < 1024; $i++) {
|
||||
curl_setopt($ch, CURLOPT_URL, "{$host}/get.inc");
|
||||
curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9/');
|
||||
curl_setopt($ch, CURLOPT_FILE, $fp);
|
||||
curl_exec($ch);
|
||||
}
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
Bug #46739 (array returned by curl_getinfo should contain content_type key)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include 'skipif.inc';
|
||||
if (!extension_loaded("curl")) {
|
||||
exit("skip curl extension not loaded");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
$ch = curl_init("{$host}/get.inc");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$ch = curl_init('http://127.0.0.1:9/');
|
||||
|
||||
curl_exec($ch);
|
||||
$info = curl_getinfo($ch);
|
||||
|
||||
@@ -67,25 +67,25 @@ foreach($options_to_check as $option) {
|
||||
--CLEAN--
|
||||
<?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?>
|
||||
--EXPECTF--
|
||||
Warning: curl_multi_add_handle(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
|
||||
%A
|
||||
Warning: curl_multi_add_handle(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
|
||||
Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
|
||||
|
||||
Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
|
||||
%A
|
||||
Ok for CURLOPT_STDERR
|
||||
|
||||
Warning: curl_multi_add_handle(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %s on line %d
|
||||
Warning: curl_multi_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %s on line %d
|
||||
|
||||
Warning: curl_multi_add_handle(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %s on line %d
|
||||
Warning: curl_multi_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %s on line %d
|
||||
Ok for CURLOPT_WRITEHEADER
|
||||
|
||||
Warning: curl_multi_add_handle(): CURLOPT_FILE resource has gone away, resetting to default in %s on line %d
|
||||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %s on line %d
|
||||
|
||||
Warning: curl_multi_add_handle(): CURLOPT_FILE resource has gone away, resetting to default in %s on line %d
|
||||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %s on line %d
|
||||
Hello World!
|
||||
Hello World!Hello World!
|
||||
Hello World!Ok for CURLOPT_FILE
|
||||
|
||||
Warning: curl_multi_add_handle(): CURLOPT_INFILE resource has gone away, resetting to default in %s on line %d
|
||||
Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %s on line %d
|
||||
|
||||
Warning: curl_multi_add_handle(): CURLOPT_INFILE resource has gone away, resetting to default in %s on line %d
|
||||
Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %s on line %d
|
||||
Ok for CURLOPT_INFILE
|
||||
@@ -1,43 +0,0 @@
|
||||
--TEST--
|
||||
Bug #77946 (Errored cURL resources returned by curl_multi_info_read() must be compatible with curl_errno() and curl_error())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
|
||||
if (!extension_loaded('curl')) {
|
||||
exit('skip curl extension not loaded');
|
||||
}
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$urls = array(
|
||||
'unknown://scheme.tld',
|
||||
);
|
||||
|
||||
$mh = curl_multi_init();
|
||||
|
||||
foreach ($urls as $i => $url) {
|
||||
$conn[$i] = curl_init($url);
|
||||
curl_multi_add_handle($mh, $conn[$i]);
|
||||
}
|
||||
|
||||
do {
|
||||
$status = curl_multi_exec($mh, $active);
|
||||
$info = curl_multi_info_read($mh);
|
||||
if (false !== $info) {
|
||||
var_dump($info['result']);
|
||||
var_dump(curl_errno($info['handle']));
|
||||
var_dump(curl_error($info['handle']));
|
||||
}
|
||||
} while ($status === CURLM_CALL_MULTI_PERFORM || $active);
|
||||
|
||||
foreach ($urls as $i => $url) {
|
||||
curl_close($conn[$i]);
|
||||
}
|
||||
|
||||
curl_multi_close($mh);
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(1)
|
||||
int(1)
|
||||
string(%d) "Protocol %Sunknown%S not supported or disabled in libcurl"
|
||||
@@ -1,35 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78775: TLS issues from HTTP request affecting other encrypted connections
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('curl')) die('skip Requires curl');
|
||||
if (!extension_loaded('openssl')) die('skip Requires openssl');
|
||||
if (getenv('SKIP_ONLINE_TESTS')) die('skip Online test');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$sock = fsockopen("tls://google.com", 443);
|
||||
|
||||
var_dump($sock);
|
||||
|
||||
$handle = curl_init('https://self-signed.badssl.com/');
|
||||
curl_setopt_array(
|
||||
$handle,
|
||||
[
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_SSL_VERIFYPEER => true,
|
||||
]
|
||||
);
|
||||
|
||||
var_dump(curl_exec($handle));
|
||||
curl_close($handle);
|
||||
|
||||
fwrite($sock, "GET / HTTP/1.0\n\n");
|
||||
var_dump(fread($sock, 8));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (stream)
|
||||
bool(false)
|
||||
string(8) "HTTP/1.0"
|
||||
@@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79033 (Curl timeout error with specific url and post)
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
$ch = curl_init();
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_URL => "{$host}/get.inc?test=post",
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => [],
|
||||
CURLINFO_HEADER_OUT => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
]);
|
||||
var_dump(curl_exec($ch));
|
||||
var_dump(curl_getinfo($ch)["request_header"]);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "array(0) {
|
||||
}
|
||||
"
|
||||
string(90) "POST /get.inc?test=post HTTP/1.1
|
||||
Host: localhost:%d
|
||||
Accept: */*
|
||||
Content-Length: 0
|
||||
|
||||
"
|
||||
@@ -1,7 +1,7 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2019 Derick Rethans
|
||||
Copyright (c) 2017-2019 MongoDB, Inc.
|
||||
Copyright (c) 2015-2017 Derick Rethans
|
||||
Copyright (c) 2017 MongoDB, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015-2019 Derick Rethans
|
||||
* Copyright (c) 2015 Derick Rethans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015-2019 Derick Rethans
|
||||
* Copyright (c) 2015 Derick Rethans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -72,3 +72,4 @@
|
||||
/* below the horizon. */
|
||||
#define astronomical_twilight(ts,lon,lat,start,end) \
|
||||
timelib_astro_rise_set_altitude( ts, lon, lat, -18.0, 0, start, end )
|
||||
|
||||
+35
-22
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015-2019 Derick Rethans
|
||||
* Copyright (c) 2015 Derick Rethans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -144,7 +144,7 @@ void timelib_isodate_from_date(timelib_sll y, timelib_sll m, timelib_sll d, time
|
||||
*id = timelib_day_of_week_ex(y, m, d, 1);
|
||||
}
|
||||
|
||||
timelib_sll timelib_daynr_from_weeknr(timelib_sll iy, timelib_sll iw, timelib_sll id)
|
||||
static timelib_sll timelib_daynr_from_weeknr_ex(timelib_sll iy, timelib_sll iw, timelib_sll id, timelib_sll *y)
|
||||
{
|
||||
timelib_sll dow, day;
|
||||
|
||||
@@ -152,41 +152,54 @@ timelib_sll timelib_daynr_from_weeknr(timelib_sll iy, timelib_sll iw, timelib_sl
|
||||
dow = timelib_day_of_week(iy, 1, 1);
|
||||
/* then use that to figure out the offset for day 1 of week 1 */
|
||||
day = 0 - (dow > 4 ? dow - 7 : dow);
|
||||
/* and adjust the year to the natural year if we need to */
|
||||
*y = (iw == 1 && day < 0 && id < dow) ? iy - 1 : iy;
|
||||
|
||||
/* Add weeks and days */
|
||||
return day + ((iw - 1) * 7) + id;
|
||||
}
|
||||
|
||||
timelib_sll timelib_daynr_from_weeknr(timelib_sll iy, timelib_sll iw, timelib_sll id)
|
||||
{
|
||||
timelib_sll dummy_iso_year;
|
||||
|
||||
return timelib_daynr_from_weeknr_ex(iy, iw, id, &dummy_iso_year);
|
||||
}
|
||||
|
||||
void timelib_date_from_isodate(timelib_sll iy, timelib_sll iw, timelib_sll id, timelib_sll *y, timelib_sll *m, timelib_sll *d)
|
||||
{
|
||||
timelib_sll daynr = timelib_daynr_from_weeknr(iy, iw, id) + 1;
|
||||
timelib_sll daynr = timelib_daynr_from_weeknr_ex(iy, iw, id, y) + 1;
|
||||
int *table;
|
||||
bool is_leap_year;
|
||||
|
||||
// Invariant: is_leap_year == timelib_is_leap(*y)
|
||||
*y = iy;
|
||||
is_leap_year = timelib_is_leap(*y);
|
||||
*m = 0;
|
||||
|
||||
// Establish invariant that daynr >= 0
|
||||
while (daynr <= 0) {
|
||||
*y -= 1;
|
||||
daynr += (is_leap_year = timelib_is_leap(*y)) ? 366 : 365;
|
||||
}
|
||||
|
||||
// Establish invariant that daynr <= number of days in *yr
|
||||
while (daynr > (is_leap_year ? 366 : 365)) {
|
||||
daynr -= is_leap_year ? 366 : 365;
|
||||
if (daynr <= 0) {
|
||||
*y += 1;
|
||||
is_leap_year = timelib_is_leap(*y);
|
||||
}
|
||||
|
||||
table = is_leap_year ? ml_table_leap : ml_table_common;
|
||||
if (timelib_is_leap(*y)) {
|
||||
table = ml_table_leap;
|
||||
if (daynr > 366) {
|
||||
*y += 1;
|
||||
daynr -= 366;
|
||||
}
|
||||
} else {
|
||||
table = ml_table_common;
|
||||
if (daynr > 365) {
|
||||
*y += 1;
|
||||
daynr -= 365;
|
||||
}
|
||||
}
|
||||
|
||||
// Establish invariant that daynr <= number of days in *m
|
||||
*m = 1;
|
||||
while (daynr > table[*m]) {
|
||||
do {
|
||||
daynr -= table[*m];
|
||||
*m += 1;
|
||||
(*m)++;
|
||||
} while (daynr > table[*m]);
|
||||
|
||||
if (daynr <= 0) {
|
||||
daynr += 31;
|
||||
*y -= 1;
|
||||
*m = 12;
|
||||
}
|
||||
|
||||
*d = daynr;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015-2019 Derick Rethans
|
||||
* Copyright (c) 2015 Derick Rethans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015-2019 Derick Rethans
|
||||
* Copyright (c) 2018 MongoDB, Inc.
|
||||
* Copyright (c) 2015 Derick Rethans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015-2019 Derick Rethans
|
||||
* Copyright (c) 2015 Derick Rethans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015-2019 Derick Rethans
|
||||
* Copyright (c) 2018 MongoDB, Inc.
|
||||
* Copyright (c) 2015 Derick Rethans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -394,7 +393,7 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
|
||||
tz->type[0].isgmtcnt
|
||||
);
|
||||
for (i = 0; i < tz->bit64.timecnt; i++) {
|
||||
printf ("%016" PRIX64 " (%20" PRId64 ") = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
|
||||
printf ("%016lX (%20ld) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
|
||||
tz->trans[i], tz->trans[i], tz->trans_idx[i],
|
||||
(long int) tz->type[tz->trans_idx[i]].offset,
|
||||
tz->type[tz->trans_idx[i]].isdst,
|
||||
@@ -405,7 +404,7 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
|
||||
);
|
||||
}
|
||||
for (i = 0; i < tz->bit64.leapcnt; i++) {
|
||||
printf ("%016" PRIX64 " (%20ld) = %d\n",
|
||||
printf ("%016lX (%20ld) = %d\n",
|
||||
tz->leap_times[i].trans,
|
||||
(long) tz->leap_times[i].trans,
|
||||
tz->leap_times[i].offset);
|
||||
@@ -503,6 +502,11 @@ timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, i
|
||||
tmp = timelib_tzinfo_ctor(timezone);
|
||||
|
||||
version = read_preamble(&tzf, tmp, &type);
|
||||
if (version == -1) {
|
||||
*error_code = TIMELIB_ERROR_UNSUPPORTED_VERSION;
|
||||
timelib_tzinfo_dtor(tmp);
|
||||
return NULL;
|
||||
}
|
||||
if (version < 2 || version > 3) {
|
||||
*error_code = TIMELIB_ERROR_UNSUPPORTED_VERSION;
|
||||
timelib_tzinfo_dtor(tmp);
|
||||
@@ -517,7 +521,6 @@ timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, i
|
||||
if (!skip_64bit_preamble(&tzf, tmp)) {
|
||||
/* 64 bit preamble is not in place */
|
||||
*error_code = TIMELIB_ERROR_CORRUPT_NO_64BIT_PREAMBLE;
|
||||
timelib_tzinfo_dtor(tmp);
|
||||
return NULL;
|
||||
}
|
||||
read_64bit_header(&tzf, tmp);
|
||||
@@ -604,8 +607,8 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
|
||||
/* If there is no transition time, we pick the first one, if that doesn't
|
||||
* exist we return NULL */
|
||||
if (!tz->bit64.timecnt || !tz->trans) {
|
||||
*transition_time = 0;
|
||||
if (tz->bit64.typecnt == 1) {
|
||||
*transition_time = INT64_MIN;
|
||||
return &(tz->type[0]);
|
||||
}
|
||||
return NULL;
|
||||
@@ -616,7 +619,6 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
|
||||
* one in case there are only DST entries. Not sure which smartass came up
|
||||
* with this idea in the first though :) */
|
||||
if (ts < tz->trans[0]) {
|
||||
*transition_time = INT64_MIN;
|
||||
return &(tz->type[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015-2019 Derick Rethans
|
||||
* Copyright (c) 2015-2017 Derick Rethans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015-2019 Derick Rethans
|
||||
* Copyright (c) 2018 MongoDB, Inc.
|
||||
* Copyright (c) 2015 Derick Rethans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -322,9 +321,9 @@ typedef struct _timelib_tzdb {
|
||||
# define timelib_free free
|
||||
#endif
|
||||
|
||||
#define TIMELIB_VERSION 201803
|
||||
#define TIMELIB_EXTENDED_VERSION 20180301
|
||||
#define TIMELIB_ASCII_VERSION "2018.03"
|
||||
#define TIMELIB_VERSION 201801
|
||||
#define TIMELIB_EXTENDED_VERSION 20180105
|
||||
#define TIMELIB_ASCII_VERSION "2018.01RC3"
|
||||
|
||||
#define TIMELIB_NONE 0x00
|
||||
#define TIMELIB_OVERRIDE_TIME 0x01
|
||||
@@ -650,7 +649,7 @@ void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info
|
||||
* It fetches the right UTC offset that is currently stored in the time
|
||||
* stamp field in 't' ('sse'), and assigns that to the 'z' field and 'dst'
|
||||
* field (whether DST is in effect at the time). It also sets the current
|
||||
* abbreviation to the 'tz_addr' field, making sure that if a value was already
|
||||
* abbrevation to the 'tz_addr' field, making sure that if a value was already
|
||||
* set it was freed.
|
||||
*
|
||||
* The time zone information in 'tz' is *not* duplicated into the 't' field so
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015-2019 Derick Rethans
|
||||
* Copyright (c) 2015 Derick Rethans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -39,7 +39,13 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
@@ -62,7 +68,10 @@
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#define TIMELIB_SECOND 1
|
||||
#define TIMELIB_MINUTE 2
|
||||
|
||||
+8569
-8098
File diff suppressed because it is too large.
Load diff
+32
-19
@@ -4,7 +4,13 @@
|
||||
{ "acdt", 1, 37800, "Australia/North" },
|
||||
{ "acdt", 1, 37800, "Australia/South" },
|
||||
{ "acdt", 1, 37800, "Australia/Yancowinna" },
|
||||
{ "acst", 0, 32400, "Australia/Adelaide" },
|
||||
{ "acst", 0, 34200, "Australia/Adelaide" },
|
||||
{ "acst", 0, 32400, "Australia/Broken_Hill" },
|
||||
{ "acst", 0, 32400, "Australia/Darwin" },
|
||||
{ "acst", 0, 32400, "Australia/North" },
|
||||
{ "acst", 0, 32400, "Australia/South" },
|
||||
{ "acst", 0, 32400, "Australia/Yancowinna" },
|
||||
{ "acst", 0, 34200, "Australia/Broken_Hill" },
|
||||
{ "acst", 0, 34200, "Australia/Darwin" },
|
||||
{ "acst", 0, 34200, "Australia/North" },
|
||||
@@ -138,16 +144,20 @@
|
||||
{ "bmt", 0, -14309, "America/Barbados" },
|
||||
{ "bmt", 0, 6264, "Europe/Tiraspol" },
|
||||
{ "bmt", 0, -17776, "America/Bogota" },
|
||||
{ "bmt", 0, 1050, "Europe/Brussels" },
|
||||
{ "bmt", 0, 10656, "Asia/Baghdad" },
|
||||
{ "bmt", 0, 1786, "Europe/Busingen" },
|
||||
{ "bmt", 0, 1786, "Europe/Vaduz" },
|
||||
{ "bmt", 0, 1786, "Europe/Zurich" },
|
||||
{ "bmt", 0, 24124, "Asia/Bangkok" },
|
||||
{ "bmt", 0, 24124, "Asia/Phnom_Penh" },
|
||||
{ "bmt", 0, 24124, "Asia/Vientiane" },
|
||||
{ "bmt", 0, 25632, "Asia/Jakarta" },
|
||||
{ "bmt", 0, 6264, "Europe/Bucharest" },
|
||||
{ "bmt", 0, 6264, "Europe/Chisinau" },
|
||||
{ "bost", 1, -12756, "America/La_Paz" },
|
||||
{ "bst", 1, 3600, "Europe/London" },
|
||||
{ "bst", 0, 3600, "Europe/London" },
|
||||
{ "bst", 1, -12756, "America/La_Paz" },
|
||||
{ "bst", 0, -39600, "America/Adak" },
|
||||
{ "bst", 0, -39600, "America/Atka" },
|
||||
{ "bst", 0, -39600, "America/Nome" },
|
||||
@@ -289,6 +299,7 @@
|
||||
{ "cet", 0, 3600, "Europe/Berlin" },
|
||||
{ "cet", 0, 7200, "Europe/Kaliningrad" },
|
||||
{ "cet", 0, 3600, "Africa/Algiers" },
|
||||
{ "cet", 0, 3600, "Africa/Casablanca" },
|
||||
{ "cet", 0, 3600, "Africa/Ceuta" },
|
||||
{ "cet", 0, 3600, "Africa/Tripoli" },
|
||||
{ "cet", 0, 3600, "Africa/Tunis" },
|
||||
@@ -361,6 +372,7 @@
|
||||
{ "cmt", 0, -16356, "America/La_Paz" },
|
||||
{ "cmt", 0, -19176, "America/Cayman" },
|
||||
{ "cmt", 0, -19176, "America/Panama" },
|
||||
{ "cmt", 0, 3020, "Europe/Copenhagen" },
|
||||
{ "cmt", 0, 6900, "Europe/Chisinau" },
|
||||
{ "cmt", 0, 6900, "Europe/Tiraspol" },
|
||||
{ "cpt", 1, -18000, "America/Chicago" },
|
||||
@@ -633,8 +645,6 @@
|
||||
{ "ewt", 1, -14400, "Canada/Eastern" },
|
||||
{ "ffmt", 0, -14660, "America/Martinique" },
|
||||
{ "fmt", 0, -4056, "Atlantic/Madeira" },
|
||||
{ "gdt", 1, 39600, "Pacific/Guam" },
|
||||
{ "gdt", 1, 39600, "Pacific/Saipan" },
|
||||
{ "gmt", 0, 0, "Africa/Abidjan" },
|
||||
{ "gmt", 0, 0, "Africa/Accra" },
|
||||
{ "gmt", 0, 0, "Africa/Bamako" },
|
||||
@@ -662,9 +672,6 @@
|
||||
{ "gmt", 0, 0, "Europe/Jersey" },
|
||||
{ "gmt", 0, 0, "Europe/London" },
|
||||
{ "gmt", 0, 0, "GB" },
|
||||
{ "gmt", 1, 0, "Europe/Bratislava" },
|
||||
{ "gmt", 1, 0, "Europe/Dublin" },
|
||||
{ "gmt", 1, 0, "Europe/Prague" },
|
||||
{ "gst", 0, 36000, "Pacific/Guam" },
|
||||
{ "gst", 0, 36000, "Pacific/Saipan" },
|
||||
{ "hdt", 1, -34200, "Pacific/Honolulu" },
|
||||
@@ -673,23 +680,20 @@
|
||||
{ "hdt", 1, -34200, "Pacific/Johnston" },
|
||||
{ "hkst", 1, 32400, "Asia/Hong_Kong" },
|
||||
{ "hkt", 0, 28800, "Asia/Hong_Kong" },
|
||||
{ "hkt", 0, 30600, "Asia/Hong_Kong" },
|
||||
{ "hmt", 0, -19776, "America/Havana" },
|
||||
{ "hmt", 0, -6872, "Atlantic/Azores" },
|
||||
{ "hmt", 0, 21200, "Asia/Calcutta" },
|
||||
{ "hmt", 0, 21200, "Asia/Dacca" },
|
||||
{ "hmt", 0, 21200, "Asia/Dhaka" },
|
||||
{ "hmt", 0, 21200, "Asia/Kolkata" },
|
||||
{ "hmt", 0, 5989, "Europe/Helsinki" },
|
||||
{ "hmt", 0, 5989, "Europe/Mariehamn" },
|
||||
{ "hpt", 1, -34200, "Pacific/Honolulu" },
|
||||
{ "hpt", 1, -34200, "Pacific/Johnston" },
|
||||
{ "hst", 0, -36000, "Pacific/Honolulu" },
|
||||
{ "hst", 0, -37800, "Pacific/Honolulu" },
|
||||
{ "hst", 0, -36000, "America/Adak" },
|
||||
{ "hst", 0, -36000, "America/Atka" },
|
||||
{ "hst", 0, -36000, "Pacific/Johnston" },
|
||||
{ "hst", 0, -37800, "Pacific/Johnston" },
|
||||
{ "hwt", 1, -34200, "Pacific/Honolulu" },
|
||||
{ "hwt", 1, -34200, "Pacific/Johnston" },
|
||||
{ "iddt", 1, 14400, "Asia/Jerusalem" },
|
||||
{ "iddt", 1, 14400, "Asia/Tel_Aviv" },
|
||||
{ "idt", 1, 10800, "Asia/Jerusalem" },
|
||||
@@ -699,6 +703,7 @@
|
||||
{ "imt", 0, 25025, "Asia/Irkutsk" },
|
||||
{ "imt", 0, 7016, "Asia/Istanbul" },
|
||||
{ "imt", 0, 7016, "Europe/Istanbul" },
|
||||
{ "imt", 0, 7016, "Europe/Sofia" },
|
||||
{ "ist", 0, 7200, "Asia/Jerusalem" },
|
||||
{ "ist", 0, 19800, "Asia/Calcutta" },
|
||||
{ "ist", 0, 19800, "Asia/Kolkata" },
|
||||
@@ -713,7 +718,6 @@
|
||||
{ "jmt", 0, 8440, "Asia/Tel_Aviv" },
|
||||
{ "jst", 0, 32400, "Asia/Tokyo" },
|
||||
{ "jst", 0, 32400, "Asia/Hong_Kong" },
|
||||
{ "jst", 0, 32400, "Asia/Manila" },
|
||||
{ "jst", 0, 32400, "Asia/Pyongyang" },
|
||||
{ "jst", 0, 32400, "Asia/Seoul" },
|
||||
{ "jst", 0, 32400, "Asia/Taipei" },
|
||||
@@ -724,8 +728,8 @@
|
||||
{ "kdt", 1, 34200, "ROK" },
|
||||
{ "kdt", 1, 36000, "ROK" },
|
||||
{ "kmt", 0, 5736, "Europe/Vilnius" },
|
||||
{ "kmt", 0, -18430, "America/Grand_Turk" },
|
||||
{ "kmt", 0, -18430, "America/Jamaica" },
|
||||
{ "kmt", 0, -18431, "America/Grand_Turk" },
|
||||
{ "kmt", 0, -18431, "America/Jamaica" },
|
||||
{ "kmt", 0, 7324, "Europe/Kiev" },
|
||||
{ "kst", 0, 30600, "Asia/Seoul" },
|
||||
{ "kst", 0, 32400, "Asia/Pyongyang" },
|
||||
@@ -762,7 +766,7 @@
|
||||
{ "met", 0, 3600, "MET" },
|
||||
{ "mmt", 0, 9017, "Europe/Moscow" },
|
||||
{ "mmt", 0, 9079, "Europe/Moscow" },
|
||||
{ "mmt", 0, -13491, "America/Montevideo" },
|
||||
{ "mmt", 0, -13484, "America/Montevideo" },
|
||||
{ "mmt", 0, -20712, "America/Managua" },
|
||||
{ "mmt", 0, -2588, "Africa/Monrovia" },
|
||||
{ "mmt", 0, -2670, "Africa/Monrovia" },
|
||||
@@ -924,15 +928,18 @@
|
||||
{ "pdt", 1, -25200, "Canada/Pacific" },
|
||||
{ "pdt", 1, -25200, "Canada/Yukon" },
|
||||
{ "pdt", 1, -25200, "Mexico/BajaNorte" },
|
||||
{ "pdt", 1, 32400, "Asia/Manila" },
|
||||
{ "pkst", 1, 21600, "Asia/Karachi" },
|
||||
{ "pkt", 0, 18000, "Asia/Karachi" },
|
||||
{ "plmt", 0, 25590, "Asia/Ho_Chi_Minh" },
|
||||
{ "plmt", 0, 25590, "Asia/Saigon" },
|
||||
{ "pmmt", 0, 35312, "Pacific/Bougainville" },
|
||||
{ "pmmt", 0, 35312, "Pacific/Port_Moresby" },
|
||||
{ "pmt", 0, -13236, "America/Paramaribo" },
|
||||
{ "pmt", 0, -13252, "America/Paramaribo" },
|
||||
{ "pmt", 0, 13505, "Asia/Yekaterinburg" },
|
||||
{ "pmt", 0, 26240, "Asia/Pontianak" },
|
||||
{ "pmt", 0, 3464, "Europe/Bratislava" },
|
||||
{ "pmt", 0, 3464, "Europe/Prague" },
|
||||
{ "pmt", 0, 561, "Africa/Algiers" },
|
||||
{ "pmt", 0, 561, "Africa/Tunis" },
|
||||
{ "pmt", 0, 561, "Europe/Monaco" },
|
||||
@@ -972,7 +979,6 @@
|
||||
{ "pst", 0, -28800, "Canada/Yukon" },
|
||||
{ "pst", 0, -28800, "Mexico/BajaNorte" },
|
||||
{ "pst", 0, -28800, "Mexico/BajaSur" },
|
||||
{ "pst", 0, 28800, "Asia/Manila" },
|
||||
{ "pwt", 1, -25200, "America/Los_Angeles" },
|
||||
{ "pwt", 1, -25200, "America/Dawson_Creek" },
|
||||
{ "pwt", 1, -25200, "America/Ensenada" },
|
||||
@@ -989,6 +995,9 @@
|
||||
{ "rmt", 0, 5794, "Europe/Riga" },
|
||||
{ "rmt", 0, 23087, "Asia/Rangoon" },
|
||||
{ "rmt", 0, 23087, "Asia/Yangon" },
|
||||
{ "rmt", 0, 2996, "Europe/Rome" },
|
||||
{ "rmt", 0, 2996, "Europe/San_Marino" },
|
||||
{ "rmt", 0, 2996, "Europe/Vatican" },
|
||||
{ "sast", 0, 7200, "Africa/Johannesburg" },
|
||||
{ "sast", 1, 10800, "Africa/Johannesburg" },
|
||||
{ "sast", 0, 5400, "Africa/Johannesburg" },
|
||||
@@ -1001,6 +1010,7 @@
|
||||
{ "sast", 0, 7200, "Africa/Mbabane" },
|
||||
{ "sast", 0, 7200, "Africa/Windhoek" },
|
||||
{ "sdmt", 0, -16800, "America/Santo_Domingo" },
|
||||
{ "set", 0, 3614, "Europe/Stockholm" },
|
||||
{ "sjmt", 0, -20173, "America/Costa_Rica" },
|
||||
{ "smt", 0, -13884, "Atlantic/Stanley" },
|
||||
{ "smt", 0, -16966, "America/Punta_Arenas" },
|
||||
@@ -1034,8 +1044,7 @@
|
||||
{ "wat", 0, 3600, "Africa/Ndjamena" },
|
||||
{ "wat", 0, 3600, "Africa/Niamey" },
|
||||
{ "wat", 0, 3600, "Africa/Porto-Novo" },
|
||||
{ "wat", 0, 3600, "Africa/Sao_Tome" },
|
||||
{ "wat", 1, 3600, "Africa/Windhoek" },
|
||||
{ "wat", 0, 3600, "Africa/Windhoek" },
|
||||
{ "wemt", 1, 7200, "Europe/Lisbon" },
|
||||
{ "wemt", 1, 7200, "Europe/Madrid" },
|
||||
{ "wemt", 1, 7200, "Europe/Monaco" },
|
||||
@@ -1043,7 +1052,9 @@
|
||||
{ "west", 1, 3600, "Europe/Paris" },
|
||||
{ "west", 1, 7200, "Europe/Luxembourg" },
|
||||
{ "west", 1, 3600, "Africa/Algiers" },
|
||||
{ "west", 1, 3600, "Africa/Casablanca" },
|
||||
{ "west", 1, 3600, "Africa/Ceuta" },
|
||||
{ "west", 1, 3600, "Africa/El_Aaiun" },
|
||||
{ "west", 1, 3600, "Atlantic/Canary" },
|
||||
{ "west", 1, 3600, "Atlantic/Faeroe" },
|
||||
{ "west", 1, 3600, "Atlantic/Faroe" },
|
||||
@@ -1056,7 +1067,9 @@
|
||||
{ "wet", 0, 0, "Europe/Paris" },
|
||||
{ "wet", 0, 3600, "Europe/Luxembourg" },
|
||||
{ "wet", 0, 0, "Africa/Algiers" },
|
||||
{ "wet", 0, 0, "Africa/Casablanca" },
|
||||
{ "wet", 0, 0, "Africa/Ceuta" },
|
||||
{ "wet", 0, 0, "Africa/El_Aaiun" },
|
||||
{ "wet", 0, 0, "Atlantic/Azores" },
|
||||
{ "wet", 0, 0, "Atlantic/Canary" },
|
||||
{ "wet", 0, 0, "Atlantic/Faeroe" },
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015-2019 Derick Rethans
|
||||
* Copyright (c) 2015 Derick Rethans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -33,6 +33,18 @@ static int month_tab[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 24
|
||||
static int days_in_month_leap[13] = { 31, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
static int days_in_month[13] = { 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
|
||||
static void do_range_limit_fraction(timelib_sll *fraction, timelib_sll *seconds)
|
||||
{
|
||||
if (*fraction < 0) {
|
||||
*fraction += 1000000;
|
||||
*seconds -= 1;
|
||||
}
|
||||
if (*fraction >= 1000000) {
|
||||
*fraction -= 1000000;
|
||||
*seconds += 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, timelib_sll *a, timelib_sll *b)
|
||||
{
|
||||
if (*a < start) {
|
||||
@@ -182,7 +194,7 @@ static void do_adjust_for_weekday(timelib_time* time)
|
||||
|
||||
void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt)
|
||||
{
|
||||
do_range_limit(0, 1000000, 1000000, &rt->us, &rt->s);
|
||||
do_range_limit_fraction(&rt->us, &rt->s);
|
||||
do_range_limit(0, 60, 60, &rt->s, &rt->i);
|
||||
do_range_limit(0, 60, 60, &rt->i, &rt->h);
|
||||
do_range_limit(0, 24, 24, &rt->h, &rt->d);
|
||||
@@ -222,7 +234,7 @@ static void magic_date_calc(timelib_time *time)
|
||||
|
||||
void timelib_do_normalize(timelib_time* time)
|
||||
{
|
||||
if (time->us != TIMELIB_UNSET) do_range_limit(0, 1000000, 1000000, &time->us, &time->s);
|
||||
if (time->us != TIMELIB_UNSET) do_range_limit_fraction(&time->us, &time->s);
|
||||
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->s, &time->i);
|
||||
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->i, &time->h);
|
||||
if (time->s != TIMELIB_UNSET) do_range_limit(0, 24, 24, &time->h, &time->d);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015-2019 Derick Rethans
|
||||
* Copyright (c) 2015 Derick Rethans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
+22
-55
@@ -60,22 +60,6 @@ static inline long long php_date_llabs( long long i ) { return i >= 0 ? i : -i;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PHPAPI time_t php_time()
|
||||
{
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
struct timeval tm;
|
||||
|
||||
if (UNEXPECTED(gettimeofday(&tm, NULL) != SUCCESS)) {
|
||||
/* fallback, can't reasonably happen */
|
||||
return time(NULL);
|
||||
}
|
||||
|
||||
return tm.tv_sec;
|
||||
#else
|
||||
return time(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* {{{ arginfo */
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_date, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, format)
|
||||
@@ -1299,7 +1283,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
|
||||
ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
|
||||
|
||||
if (ZEND_NUM_ARGS() == 1) {
|
||||
ts = php_time();
|
||||
ts = time(NULL);
|
||||
}
|
||||
|
||||
RETURN_STR(php_format_date(ZSTR_VAL(format), ZSTR_LEN(format), ts, localtime));
|
||||
@@ -1464,7 +1448,7 @@ PHP_FUNCTION(idate)
|
||||
}
|
||||
|
||||
if (ZEND_NUM_ARGS() == 1) {
|
||||
ts = php_time();
|
||||
ts = time(NULL);
|
||||
}
|
||||
|
||||
ret = php_idate(ZSTR_VAL(format)[0], ts, 0);
|
||||
@@ -1536,7 +1520,7 @@ PHP_FUNCTION(strtotime)
|
||||
now->tz_info = tzi;
|
||||
now->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
timelib_unixtime2local(now,
|
||||
(ZEND_NUM_ARGS() == 2) ? (timelib_sll) preset_ts : (timelib_sll) php_time());
|
||||
(ZEND_NUM_ARGS() == 2) ? (timelib_sll) preset_ts : (timelib_sll) time(NULL));
|
||||
|
||||
t = timelib_strtotime(ZSTR_VAL(times), ZSTR_LEN(times), &error,
|
||||
DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
|
||||
@@ -1579,12 +1563,12 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
|
||||
/* Initialize structure with current time */
|
||||
now = timelib_time_ctor();
|
||||
if (gmt) {
|
||||
timelib_unixtime2gmt(now, (timelib_sll) php_time());
|
||||
timelib_unixtime2gmt(now, (timelib_sll) time(NULL));
|
||||
} else {
|
||||
tzi = get_timezone_info();
|
||||
now->tz_info = tzi;
|
||||
now->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
timelib_unixtime2local(now, (timelib_sll) php_time());
|
||||
timelib_unixtime2local(now, (timelib_sll) time(NULL));
|
||||
}
|
||||
/* Fill in the new data */
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
@@ -1685,7 +1669,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
|
||||
timelib_time_offset *offset = NULL;
|
||||
zend_string *buf;
|
||||
|
||||
timestamp = (zend_long) php_time();
|
||||
timestamp = (zend_long) time(NULL);
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_STR(format)
|
||||
@@ -1793,7 +1777,7 @@ PHP_FUNCTION(time)
|
||||
return;
|
||||
}
|
||||
|
||||
RETURN_LONG((zend_long)php_time(NULL));
|
||||
RETURN_LONG((zend_long)time(NULL));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1801,7 +1785,7 @@ PHP_FUNCTION(time)
|
||||
Returns the results of the C system call localtime as an associative array if the associative_array argument is set to 1 other wise it is a regular array */
|
||||
PHP_FUNCTION(localtime)
|
||||
{
|
||||
zend_long timestamp = (zend_long)php_time();
|
||||
zend_long timestamp = (zend_long)time(NULL);
|
||||
zend_bool associative = 0;
|
||||
timelib_tzinfo *tzi;
|
||||
timelib_time *ts;
|
||||
@@ -1850,7 +1834,7 @@ PHP_FUNCTION(localtime)
|
||||
Get date/time information */
|
||||
PHP_FUNCTION(getdate)
|
||||
{
|
||||
zend_long timestamp = (zend_long)php_time();
|
||||
zend_long timestamp = (zend_long)time(NULL);
|
||||
timelib_tzinfo *tzi;
|
||||
timelib_time *ts;
|
||||
|
||||
@@ -2923,7 +2907,7 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht
|
||||
zval tmp_obj;
|
||||
timelib_tzinfo *tzi;
|
||||
|
||||
z_date = zend_hash_str_find(myht, "date", sizeof("date")-1);
|
||||
z_date = zend_hash_str_find(myht, "date", sizeof("data")-1);
|
||||
if (z_date && Z_TYPE_P(z_date) == IS_STRING) {
|
||||
zval *z_timezone_type = zend_hash_str_find(myht, "timezone_type", sizeof("timezone_type")-1);
|
||||
if (z_timezone_type && Z_TYPE_P(z_timezone_type) == IS_LONG) {
|
||||
@@ -3297,7 +3281,6 @@ PHP_METHOD(DateTimeImmutable, modify)
|
||||
|
||||
date_clone_immutable(object, &new_object);
|
||||
if (!php_date_modify(&new_object, modify, modify_len)) {
|
||||
zval_ptr_dtor(&new_object);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -4360,20 +4343,6 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
#define PHP_DATE_INTERVAL_READ_PROPERTY_DAYS(member) \
|
||||
do { \
|
||||
zval *z_arg = zend_hash_str_find(myht, "days", sizeof("days") - 1); \
|
||||
if (z_arg && Z_TYPE_P(z_arg) == IS_FALSE) { \
|
||||
(*intobj)->diff->member = -99999; \
|
||||
} else if (z_arg && Z_TYPE_P(z_arg) <= IS_STRING) { \
|
||||
zend_string *str = zval_get_string(z_arg); \
|
||||
DATE_A64I((*intobj)->diff->member, ZSTR_VAL(str)); \
|
||||
zend_string_release(str); \
|
||||
} else { \
|
||||
(*intobj)->diff->member = -1LL; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
#define PHP_DATE_INTERVAL_READ_PROPERTY_DOUBLE(element, member, def) \
|
||||
do { \
|
||||
zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \
|
||||
@@ -4390,21 +4359,19 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY("h", h, timelib_sll, -1)
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY("i", i, timelib_sll, -1)
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY("s", s, timelib_sll, -1)
|
||||
{
|
||||
do {
|
||||
zval *z_arg = zend_hash_str_find(myht, "f", sizeof("f") - 1);
|
||||
(*intobj)->diff->us = -1000000;
|
||||
if (z_arg) {
|
||||
double val = zval_get_double(z_arg) * 1000000;
|
||||
if (val >= 0 && val < 1000000) {
|
||||
(*intobj)->diff->us = val;
|
||||
}
|
||||
(*intobj)->diff->us = ((double)zval_get_double(z_arg) * 1000000);
|
||||
} else {
|
||||
(*intobj)->diff->us = (double) -1000000;
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY("weekday", weekday, int, -1)
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY("weekday_behavior", weekday_behavior, int, -1)
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY("first_last_day_of", first_last_day_of, int, -1)
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY("invert", invert, int, 0);
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY_DAYS(days);
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY_I64("days", days);
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY("special_type", special.type, unsigned int, 0);
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY_I64("special_amount", special.amount);
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY("have_weekday_relative", have_weekday_relative, unsigned int, 0);
|
||||
@@ -5171,7 +5138,7 @@ static HashTable *date_object_get_properties_period(zval *object) /* {{{ */
|
||||
|
||||
if (period_obj->start) {
|
||||
php_date_obj *date_obj;
|
||||
object_init_ex(&zv, period_obj->start_ce);
|
||||
object_init_ex(&zv, date_ce_date);
|
||||
date_obj = Z_PHPDATE_P(&zv);
|
||||
date_obj->time = timelib_time_clone(period_obj->start);
|
||||
} else {
|
||||
@@ -5181,7 +5148,7 @@ static HashTable *date_object_get_properties_period(zval *object) /* {{{ */
|
||||
|
||||
if (period_obj->current) {
|
||||
php_date_obj *date_obj;
|
||||
object_init_ex(&zv, period_obj->start_ce);
|
||||
object_init_ex(&zv, date_ce_date);
|
||||
date_obj = Z_PHPDATE_P(&zv);
|
||||
date_obj->time = timelib_time_clone(period_obj->current);
|
||||
} else {
|
||||
@@ -5191,7 +5158,7 @@ static HashTable *date_object_get_properties_period(zval *object) /* {{{ */
|
||||
|
||||
if (period_obj->end) {
|
||||
php_date_obj *date_obj;
|
||||
object_init_ex(&zv, period_obj->start_ce);
|
||||
object_init_ex(&zv, date_ce_date);
|
||||
date_obj = Z_PHPDATE_P(&zv);
|
||||
date_obj->time = timelib_time_clone(period_obj->end);
|
||||
} else {
|
||||
@@ -5228,7 +5195,7 @@ static int php_date_period_initialize_from_hash(php_period_obj *period_obj, Hash
|
||||
|
||||
ht_entry = zend_hash_str_find(myht, "start", sizeof("start")-1);
|
||||
if (ht_entry) {
|
||||
if (Z_TYPE_P(ht_entry) == IS_OBJECT && instanceof_function(Z_OBJCE_P(ht_entry), date_ce_interface)) {
|
||||
if (Z_TYPE_P(ht_entry) == IS_OBJECT && Z_OBJCE_P(ht_entry) == date_ce_date) {
|
||||
php_date_obj *date_obj;
|
||||
date_obj = Z_PHPDATE_P(ht_entry);
|
||||
period_obj->start = timelib_time_clone(date_obj->time);
|
||||
@@ -5242,7 +5209,7 @@ static int php_date_period_initialize_from_hash(php_period_obj *period_obj, Hash
|
||||
|
||||
ht_entry = zend_hash_str_find(myht, "end", sizeof("end")-1);
|
||||
if (ht_entry) {
|
||||
if (Z_TYPE_P(ht_entry) == IS_OBJECT && instanceof_function(Z_OBJCE_P(ht_entry), date_ce_interface)) {
|
||||
if (Z_TYPE_P(ht_entry) == IS_OBJECT && Z_OBJCE_P(ht_entry) == date_ce_date) {
|
||||
php_date_obj *date_obj;
|
||||
date_obj = Z_PHPDATE_P(ht_entry);
|
||||
period_obj->end = timelib_time_clone(date_obj->time);
|
||||
@@ -5255,7 +5222,7 @@ static int php_date_period_initialize_from_hash(php_period_obj *period_obj, Hash
|
||||
|
||||
ht_entry = zend_hash_str_find(myht, "current", sizeof("current")-1);
|
||||
if (ht_entry) {
|
||||
if (Z_TYPE_P(ht_entry) == IS_OBJECT && instanceof_function(Z_OBJCE_P(ht_entry), date_ce_interface)) {
|
||||
if (Z_TYPE_P(ht_entry) == IS_OBJECT && Z_OBJCE_P(ht_entry) == date_ce_date) {
|
||||
php_date_obj *date_obj;
|
||||
date_obj = Z_PHPDATE_P(ht_entry);
|
||||
period_obj->current = timelib_time_clone(date_obj->time);
|
||||
|
||||
@@ -204,8 +204,6 @@ ZEND_END_MODULE_GLOBALS(date)
|
||||
|
||||
#define DATEG(v) ZEND_MODULE_GLOBALS_ACCESSOR(date, v)
|
||||
|
||||
PHPAPI time_t php_time();
|
||||
|
||||
/* Backwards compatibility wrapper */
|
||||
PHPAPI zend_long php_parse_date(char *string, zend_long *now);
|
||||
PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt);
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
DateTimeImmutable::modify() with invalid format
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$datetime = new DateTimeImmutable;
|
||||
var_dump($datetime->modify(''));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: DateTimeImmutable::modify(): Failed to parse time string () at position 0 ( in %s on line %d
|
||||
bool(false)
|
||||
@@ -26,16 +26,16 @@ var_dump( $abbr["acst"] );
|
||||
--EXPECTF--
|
||||
*** Testing DateTimeZone::listAbbreviations() : basic functionality ***
|
||||
string(5) "array"
|
||||
int(144)
|
||||
int(%d)
|
||||
|
||||
-- Format a sample entry --
|
||||
array(6) {
|
||||
array(12) {
|
||||
[0]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(34200)
|
||||
int(32400)
|
||||
["timezone_id"]=>
|
||||
string(18) "Australia/Adelaide"
|
||||
}
|
||||
@@ -46,9 +46,63 @@ array(6) {
|
||||
["offset"]=>
|
||||
int(34200)
|
||||
["timezone_id"]=>
|
||||
string(21) "Australia/Broken_Hill"
|
||||
string(18) "Australia/Adelaide"
|
||||
}
|
||||
[2]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(32400)
|
||||
["timezone_id"]=>
|
||||
string(21) "Australia/Broken_Hill"
|
||||
}
|
||||
[3]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(32400)
|
||||
["timezone_id"]=>
|
||||
string(16) "Australia/Darwin"
|
||||
}
|
||||
[4]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(32400)
|
||||
["timezone_id"]=>
|
||||
string(15) "Australia/North"
|
||||
}
|
||||
[5]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(32400)
|
||||
["timezone_id"]=>
|
||||
string(15) "Australia/South"
|
||||
}
|
||||
[6]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(32400)
|
||||
["timezone_id"]=>
|
||||
string(20) "Australia/Yancowinna"
|
||||
}
|
||||
[7]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(34200)
|
||||
["timezone_id"]=>
|
||||
string(21) "Australia/Broken_Hill"
|
||||
}
|
||||
[8]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
@@ -57,7 +111,7 @@ array(6) {
|
||||
["timezone_id"]=>
|
||||
string(16) "Australia/Darwin"
|
||||
}
|
||||
[3]=>
|
||||
[9]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
@@ -66,7 +120,7 @@ array(6) {
|
||||
["timezone_id"]=>
|
||||
string(15) "Australia/North"
|
||||
}
|
||||
[4]=>
|
||||
[10]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
@@ -75,7 +129,7 @@ array(6) {
|
||||
["timezone_id"]=>
|
||||
string(15) "Australia/South"
|
||||
}
|
||||
[5]=>
|
||||
[11]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
|
||||
@@ -39,7 +39,7 @@ DateInterval Object
|
||||
[weekday_behavior] => 0
|
||||
[first_last_day_of] => 0
|
||||
[invert] => 0
|
||||
[days] =>
|
||||
[days] => 0
|
||||
[special_type] => 0
|
||||
[special_amount] => 0
|
||||
[have_weekday_relative] => 0
|
||||
|
||||
@@ -136,7 +136,7 @@ object(DatePeriod)#%d (6) {
|
||||
["invert"]=>
|
||||
int(0)
|
||||
["days"]=>
|
||||
bool(false)
|
||||
int(0)
|
||||
["special_type"]=>
|
||||
int(0)
|
||||
["special_amount"]=>
|
||||
|
||||
@@ -71,7 +71,7 @@ object(DateInterval)#2 (16) {
|
||||
["invert"]=>
|
||||
int(0)
|
||||
["days"]=>
|
||||
bool(false)
|
||||
int(0)
|
||||
["special_type"]=>
|
||||
int(0)
|
||||
["special_amount"]=>
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70153 (\DateInterval incorrectly unserialized)
|
||||
--FILE--
|
||||
<?php
|
||||
$i1 = \DateInterval::createFromDateString('+1 month');
|
||||
$i2 = unserialize(serialize($i1));
|
||||
var_dump($i1->days, $i2->days);
|
||||
var_dump($i2->special_amount, $i2->special_amount);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
int(0)
|
||||
int(0)
|
||||
@@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78751 (Serialising DatePeriod converts DateTimeImmutable)
|
||||
--FILE--
|
||||
<?php
|
||||
$oDay = new DateTimeImmutable('2019-10-25');
|
||||
$oDateInterval = DateInterval::createFromDateString('1 day');
|
||||
$oDays = new DatePeriod($oDay, $oDateInterval, $oDay->modify('+1 day'));
|
||||
$oDays = unserialize(serialize($oDays));
|
||||
var_dump(
|
||||
$oDays->start instanceof DateTimeImmutable,
|
||||
$oDays->end instanceof DateTimeImmutable
|
||||
);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -1,42 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79015 (undefined-behavior in php_date.c)
|
||||
--FILE--
|
||||
<?php
|
||||
$payload = 'O:12:"DateInterval":16:{s:1:"y";i:1;s:1:"m";i:0;s:1:"d";i:4;s:1:"h";i:0;s:1:"i";i:0;s:1:"s";i:0;s:1:"f";i:9999999999990;s:7:"weekday";i:0;s:16:"weekday_behavior";i:0;s:17:"first_last_day_of";i:0;s:6:"invert";i:0;s:4:"days";b:0;s:12:"special_type";i:0;s:14:"special_amount";i:0;s:21:"have_weekday_relative";i:0;s:21:"have_special_relative";i:0;}';
|
||||
var_dump(unserialize($payload));
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(DateInterval)#%d (16) {
|
||||
["y"]=>
|
||||
int(1)
|
||||
["m"]=>
|
||||
int(0)
|
||||
["d"]=>
|
||||
int(4)
|
||||
["h"]=>
|
||||
int(0)
|
||||
["i"]=>
|
||||
int(0)
|
||||
["s"]=>
|
||||
int(0)
|
||||
["f"]=>
|
||||
float(-1)
|
||||
["weekday"]=>
|
||||
int(0)
|
||||
["weekday_behavior"]=>
|
||||
int(0)
|
||||
["first_last_day_of"]=>
|
||||
int(0)
|
||||
["invert"]=>
|
||||
int(0)
|
||||
["days"]=>
|
||||
bool(false)
|
||||
["special_type"]=>
|
||||
int(0)
|
||||
["special_amount"]=>
|
||||
int(0)
|
||||
["have_weekday_relative"]=>
|
||||
int(0)
|
||||
["have_special_relative"]=>
|
||||
int(0)
|
||||
}
|
||||
Loaded 100 of 540 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user