mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-13 04:00:50 +00:00
Compare commits
336
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aeb198af40 | ||
|
|
6da7f015e1 | ||
|
|
3fc0e2bb80 | ||
|
|
790b0b109a | ||
|
|
1ed9ebdea5 | ||
|
|
f12dc90e5e | ||
|
|
a87ef5e3dd | ||
|
|
e60c507362 | ||
|
|
81efd489db | ||
|
|
f9f4a68368 | ||
|
|
a4a535d8de | ||
|
|
d89157cd67 | ||
|
|
e1934f8515 | ||
|
|
85e8ccd55e | ||
|
|
bf53d30fae | ||
|
|
61e1147146 | ||
|
|
b419b24ead | ||
|
|
bab8b3a8be | ||
|
|
afd96392a3 | ||
|
|
1f9a77baef | ||
|
|
8af14024c2 | ||
|
|
3e8774e57a | ||
|
|
09b108246a | ||
|
|
053df4ac3b | ||
|
|
a9e332e027 | ||
|
|
0ed6c37140 | ||
|
|
6913ec3282 | ||
|
|
8413df5e55 | ||
|
|
ef439abd46 | ||
|
|
88cc70eb94 | ||
|
|
6ea13baaf1 | ||
|
|
b29ecec4ef | ||
|
|
fd6874c64d | ||
|
|
8947fd9e9f | ||
|
|
4adf3dc109 | ||
|
|
d69894734d | ||
|
|
284fb08fdc | ||
|
|
cd1101e8c8 | ||
|
|
42e8b85d94 | ||
|
|
76c2bef9b0 | ||
|
|
3429370d69 | ||
|
|
536c91c535 | ||
|
|
44fe025c28 | ||
|
|
dc7aa22b18 | ||
|
|
6df1665bb3 | ||
|
|
bbed5564eb | ||
|
|
38f1288b64 | ||
|
|
94924841ac | ||
|
|
76683ea999 | ||
|
|
07286d2fb4 | ||
|
|
a22a06c351 | ||
|
|
8e63bb5e46 | ||
|
|
92273bef66 | ||
|
|
552ce9c763 | ||
|
|
68fd435ba8 | ||
|
|
2eb159d589 | ||
|
|
727929765b | ||
|
|
d142dfc93d | ||
|
|
4ae807e84e | ||
|
|
9bfda013d3 | ||
|
|
aeb6d13185 | ||
|
|
dea2989ab8 | ||
|
|
fec71e3f25 | ||
|
|
585131f901 | ||
|
|
30eb4b3563 | ||
|
|
99fe0471ed | ||
|
|
a2b2aaa67a | ||
|
|
f1c4b48c84 | ||
|
|
0e6e2297fc | ||
|
|
e1c80d8ea7 | ||
|
|
d758691b9b | ||
|
|
c624a7fe43 | ||
|
|
5649267b25 | ||
|
|
5d3d2b9827 | ||
|
|
946a1e4314 | ||
|
|
1cbcf0f4f1 | ||
|
|
dee243d475 | ||
|
|
a3169964c0 | ||
|
|
793dfa91bb | ||
|
|
99d4b2bddc | ||
|
|
853b426ecf | ||
|
|
d7e8abb4aa | ||
|
|
22e7ee3bb3 | ||
|
|
626bc0e7cc | ||
|
|
6191df7553 | ||
|
|
b05f364333 | ||
|
|
126dd8e1eb | ||
|
|
5dae0eae62 | ||
|
|
a49d53baa2 | ||
|
|
d9680272c7 | ||
|
|
1eb706179f | ||
|
|
9e4603f772 | ||
|
|
8d51af9bc2 | ||
|
|
eaa9048973 | ||
|
|
6d6d954d0d | ||
|
|
a07e85f93f | ||
|
|
2b540b2f52 | ||
|
|
1fa238a7b3 | ||
|
|
e3236d8847 | ||
|
|
b42a13b08a | ||
|
|
9e2ac14702 | ||
|
|
8f384bea93 | ||
|
|
b19fdc18a9 | ||
|
|
5d827c89cf | ||
|
|
845d07b343 | ||
|
|
5664035ffe | ||
|
|
d59aac58b3 | ||
|
|
c817b8020c | ||
|
|
19588a8f3b | ||
|
|
31d85b8417 | ||
|
|
a2b758dab5 | ||
|
|
9b8bf13b3a | ||
|
|
4b03e102c5 | ||
|
|
f8202b5513 | ||
|
|
72b9105d30 | ||
|
|
b59a9381b9 | ||
|
|
6572c00b81 | ||
|
|
d3d3404db7 | ||
|
|
23bb9f4e2f | ||
|
|
28cf080701 | ||
|
|
b3f74b0b7d | ||
|
|
964de035a7 | ||
|
|
b3668aabf7 | ||
|
|
e41b7f6db4 | ||
|
|
46b982409a | ||
|
|
cd2f2cd7d0 | ||
|
|
4e190691e2 | ||
|
|
b1cdf06673 | ||
|
|
4e4d8a4a6c | ||
|
|
e9e2fa4ad4 | ||
|
|
39e756e7fe | ||
|
|
3121b7174f | ||
|
|
0ba7c3eadf | ||
|
|
b2ea507bea | ||
|
|
b2915fc332 | ||
|
|
5e4dbce586 | ||
|
|
60dca2295d | ||
|
|
2f51764e5d | ||
|
|
97b80bd83b | ||
|
|
bdf24f8d6d | ||
|
|
fff6b18657 | ||
|
|
ef165b4422 | ||
|
|
1b969a74d0 | ||
|
|
15782b27b8 | ||
|
|
30de357fa1 | ||
|
|
82f35ab089 | ||
|
|
eb7e45f662 | ||
|
|
1a031a242c | ||
|
|
577ed5bfa4 | ||
|
|
b1643e166d | ||
|
|
f5227c5863 | ||
|
|
a85e4d5336 | ||
|
|
6de97402b5 | ||
|
|
81fd1c5206 | ||
|
|
737c1b492c | ||
|
|
504cd03fc3 | ||
|
|
aa2e2c3f93 | ||
|
|
445d51347d | ||
|
|
d574df63dc | ||
|
|
d5943f5a11 | ||
|
|
b065fbde19 | ||
|
|
7cbc6b6546 | ||
|
|
7cf651c39e | ||
|
|
be7f405f6b | ||
|
|
4a9f78f9d7 | ||
|
|
c8c183eb62 | ||
|
|
55d34f7023 | ||
|
|
bbdbc2658c | ||
|
|
562591f5eb | ||
|
|
3a5664fdfe | ||
|
|
3f23380361 | ||
|
|
f34db7fc2a | ||
|
|
b35b9eb1d6 | ||
|
|
8db732155f | ||
|
|
359a78b16c | ||
|
|
7dc6c3960b | ||
|
|
53299d610a | ||
|
|
daa243d1a0 | ||
|
|
fa7fbfd518 | ||
|
|
6afc3cede8 | ||
|
|
e2ed7e6716 | ||
|
|
6f617b7759 | ||
|
|
56a2ea7aa2 | ||
|
|
79efd55fc3 | ||
|
|
b864abfe23 | ||
|
|
07a4d134ab | ||
|
|
b30e4a5aa6 | ||
|
|
c2c5c9a973 | ||
|
|
856c5d2837 | ||
|
|
5a90dc77b8 | ||
|
|
6fbab09ef0 | ||
|
|
a986e70991 | ||
|
|
918f09f72a | ||
|
|
e7fcc45c43 | ||
|
|
476339646c | ||
|
|
ee5828205e | ||
|
|
a520974740 | ||
|
|
63d6a2b697 | ||
|
|
a6812c0c84 | ||
|
|
b317f0eb59 | ||
|
|
e0eca26285 | ||
|
|
49bac9b77b | ||
|
|
46faf8f018 | ||
|
|
349a388b90 | ||
|
|
a0f450a023 | ||
|
|
e08cc4d921 | ||
|
|
5161cebe28 | ||
|
|
292354f73a | ||
|
|
e7e66d5275 | ||
|
|
20320598e5 | ||
|
|
956ecc2ce5 | ||
|
|
b8ed9ac140 | ||
|
|
344d01bee3 | ||
|
|
bd0514913b | ||
|
|
c1b9088903 | ||
|
|
290e520c03 | ||
|
|
c9acc90186 | ||
|
|
ebfa05677b | ||
|
|
eea9d61763 | ||
|
|
8a19fe29de | ||
|
|
a91fb18da4 | ||
|
|
bf1ace7dd3 | ||
|
|
c9037421ac | ||
|
|
26977fdfdd | ||
|
|
e2e3ddac7d | ||
|
|
1d4c38421a | ||
|
|
2e26b063b6 | ||
|
|
c570980175 | ||
|
|
9ccf3fb996 | ||
|
|
548d1ec27c | ||
|
|
24f4dff075 | ||
|
|
59ba991b9c | ||
|
|
cc44bad1f6 | ||
|
|
07daf6cd62 | ||
|
|
fcdb12ed4d | ||
|
|
c5f1b384b5 | ||
|
|
17d4e86dda | ||
|
|
2d737a1e4b | ||
|
|
88ffe05797 | ||
|
|
37043e07df | ||
|
|
da1816c3d3 | ||
|
|
ad48464ec2 | ||
|
|
c77f0506d0 | ||
|
|
590d8f8263 | ||
|
|
a7ff3a6483 | ||
|
|
eab0079c90 | ||
|
|
d60d16bda6 | ||
|
|
9ad094e371 | ||
|
|
193f28c7d5 | ||
|
|
af7639683f | ||
|
|
a520c24269 | ||
|
|
3eb057c4a7 | ||
|
|
768ad70f70 | ||
|
|
93b3d2f6ee | ||
|
|
94421e5724 | ||
|
|
e39296d10b | ||
|
|
66c02cc0a1 | ||
|
|
c72d6da461 | ||
|
|
7a6d737de7 | ||
|
|
f573ba1948 | ||
|
|
4e0af6d862 | ||
|
|
f3cf8966be | ||
|
|
f5e4771824 | ||
|
|
499f2ac132 | ||
|
|
8c76d898a9 | ||
|
|
bf242d58e7 | ||
|
|
1c1de0c41a | ||
|
|
33994ebd95 | ||
|
|
a6fa097ceb | ||
|
|
0d568b9fd5 | ||
|
|
79b5b1a97f | ||
|
|
3f73916f10 | ||
|
|
a7de2af46c | ||
|
|
608f2112e9 | ||
|
|
9d141f9889 | ||
|
|
4a91f66b8f | ||
|
|
76783a9bcc | ||
|
|
58b607c9ea | ||
|
|
8aa7865997 | ||
|
|
e2c3bc80e3 | ||
|
|
709897c2a5 | ||
|
|
94d37a5dd7 | ||
|
|
9345c191db | ||
|
|
2e56e14e39 | ||
|
|
9a274de4f4 | ||
|
|
0793af0673 | ||
|
|
d0d02ecc4e | ||
|
|
350f2212ff | ||
|
|
ef1a1a0698 | ||
|
|
be94c0c3c6 | ||
|
|
59852c0321 | ||
|
|
cbda1b1c6a | ||
|
|
e6c2b28865 | ||
|
|
17f7fb7605 | ||
|
|
6285bb52fa | ||
|
|
42cac9d7d7 | ||
|
|
17997a908d | ||
|
|
fa65f5ecf5 | ||
|
|
c02dfddda3 | ||
|
|
d20fc5a192 | ||
|
|
3b73c9fb86 | ||
|
|
2a535a9707 | ||
|
|
ba8c4894d8 | ||
|
|
a6daded1a4 | ||
|
|
d63fdced2e | ||
|
|
0e3d4911fa | ||
|
|
a54ee8a947 | ||
|
|
e7a83ec8df | ||
|
|
6791107319 | ||
|
|
ee18687f97 | ||
|
|
3fa9f9cfae | ||
|
|
07bbc54658 | ||
|
|
852e35317d | ||
|
|
c42b7dd6d3 | ||
|
|
a63422029e | ||
|
|
d57d74b271 | ||
|
|
2bca35eacc | ||
|
|
0c450967e1 | ||
|
|
a207b3574b | ||
|
|
9d82a01d01 | ||
|
|
dfe5fd2a37 | ||
|
|
db0eaa8cf1 | ||
|
|
48abed7fd8 | ||
|
|
f65956e4fb | ||
|
|
aa0e29a668 | ||
|
|
8f0c87e1b6 | ||
|
|
ba05b2c6b0 | ||
|
|
825f47564a | ||
|
|
22ed362810 | ||
|
|
432ad35b55 | ||
|
|
726c07e9af | ||
|
|
7404d756e9 | ||
|
|
40f7533cc1 | ||
|
|
e944ae6b2a | ||
|
|
e1f418dd18 | ||
|
|
086b476c27 |
No files matched your search
+1
-1
@@ -33,7 +33,7 @@ environment:
|
||||
PARALLEL: -j2
|
||||
- THREAD_SAFE: 1
|
||||
OPCACHE: 1
|
||||
PARALLEL:
|
||||
PARALLEL: -j2
|
||||
INTRINSICS: AVX
|
||||
|
||||
services:
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ end_of_line = lf
|
||||
charset = utf-8
|
||||
tab_width = 4
|
||||
|
||||
[{*.{awk,bat,c,cpp,d,h,l,mk,re,skl,w32,y},Makefile*}]
|
||||
[{*.{awk,bat,c,cpp,d,h,l,re,skl,w32,y},Makefile*}]
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Replace $Id$ strings with 40-character hexadecimal blob object name.
|
||||
/ext/mysqlnd/mysqlnd.h ident
|
||||
/ext/ext_skel.php ident
|
||||
/ext/phar/phar/pharcommand.inc ident
|
||||
/ext/dba/libinifile/inifile.c ident
|
||||
|
||||
+1
-1
@@ -208,7 +208,7 @@ php
|
||||
/win32/*.positions
|
||||
/win32/*.suo
|
||||
/win32/ext
|
||||
/win32/phpts.def
|
||||
/win32/syslog.reg
|
||||
/win32/wsyslog.h
|
||||
|
||||
# Standard object files generated by Visual Studio
|
||||
|
||||
@@ -16,7 +16,6 @@ addons:
|
||||
- libenchant-dev
|
||||
- libaspell-dev
|
||||
- libpspell-dev
|
||||
- librecode-dev
|
||||
- libsasl2-dev
|
||||
- libxpm-dev
|
||||
- libzip-dev
|
||||
|
||||
@@ -429,11 +429,6 @@ PRIMARY MAINTAINER: Unkown
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: recode
|
||||
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de> (2000 - 2000)
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: reflection
|
||||
PRIMARY MAINTAINER: Marcus Börger <helly@php.net> (2003 - 2009)
|
||||
Johannes Schlüter <johannes@php.net> (2006 - 2014)
|
||||
|
||||
@@ -1,5 +1,91 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
08 Aug 2019, PHP 7.4.0beta2
|
||||
|
||||
- Core:
|
||||
. Fixed bug #78340 (Include of stream wrapper not reading whole file).
|
||||
(Nikita)
|
||||
. Fixed bug #78344 (Segmentation fault on zend_check_protected). (Nikita)
|
||||
. Fixed bug #78356 (Array returned from ArrayAccess is incorrectly unpacked
|
||||
as argument). (Nikita)
|
||||
|
||||
- Exif:
|
||||
. Fixed bug #78333 (Exif crash (bus error) due to wrong alignment and
|
||||
invalid cast). (Nikita)
|
||||
. 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)
|
||||
|
||||
- Iconv:
|
||||
. Fixed bug #78342 (Bus error in configure test for iconv //IGNORE). (Rainer
|
||||
Jung)
|
||||
|
||||
- MySQLnd:
|
||||
. Fixed bug #78179 (MariaDB server version incorrectly detected). (cmb)
|
||||
. Fixed bug #78213 (Empty row pocket). (cmb)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #78341 (Failure to detect smart branch in DFA pass). (Nikita)
|
||||
. Fixed bug #78376 (Incorrect preloading of constant static properties).
|
||||
(Dmitry)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #78338 (Array cross-border reading in PCRE). (cmb)
|
||||
|
||||
- PDO_Sqlite:
|
||||
. Fixed bug #78348 (Remove -lrt from pdo_sqlite.so). (Peter Kokot)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #77919 (Potential UAF in Phar RSHUTDOWN). (cmb)
|
||||
|
||||
- Standard:
|
||||
. 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)
|
||||
|
||||
25 Jul 2019, PHP 7.4.0beta1
|
||||
|
||||
- Core:
|
||||
. Fixed bug #78212 (Segfault in built-in webserver). (cmb)
|
||||
. Fixed bug #60677 (CGI doesn't properly validate shebang line contains #!).
|
||||
(Nikita)
|
||||
. Fixed bug #78066 (PHP eats the first byte of a program that comes from
|
||||
process substitution). (Nikita)
|
||||
. Fixed bug #52752 (Crash when lexing). (Nikita)
|
||||
. Implemented RFC: Deprecate curly brace syntax for accessing array elements
|
||||
and string offsets.
|
||||
https://wiki.php.net/rfc/deprecate_curly_braces_array_access (Andrey Gromov)
|
||||
. Implemented RFC: Deprecations for PHP 7.4.
|
||||
https://wiki.php.net/rfc/deprecations_php_7_4 (Kalle, Nikita)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #78314 (missing freetype support/functions with external gd).
|
||||
(Remi)
|
||||
|
||||
- Libxml:
|
||||
. Fixed bug #78279 (libxml_disable_entity_loader settings is shared between
|
||||
requests (cgi-fcgi)). (Nikita)
|
||||
|
||||
- LiteSpeed:
|
||||
. Updated to LiteSpeed SAPI V7.5 (Fixed clean shutdown). (George Wang)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #78271 (Invalid result of if-else). (Nikita)
|
||||
. Added new INI directive opcache.cache_id (Windows only). (cmb)
|
||||
|
||||
- PDO:
|
||||
. Implemented FR #71885 (Allow escaping question mark placeholders).
|
||||
https://wiki.php.net/rfc/pdo_escape_placeholders (Matteo)
|
||||
|
||||
- Recode:
|
||||
. Unbundled the recode extension. (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #78282 (atime and mtime mismatch). (cmb)
|
||||
. Fixed bug #73535 (php_sockop_write() returns 0 on error, can be used to
|
||||
trigger Denial of Service). (Nikita)
|
||||
|
||||
11 Jul 2019, PHP 7.4.0alpha3
|
||||
|
||||
- Core:
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
|
||||
#if !defined(__CYGWIN__) && defined(WIN32)
|
||||
# define TSRM_WIN32
|
||||
# include "tsrm_config.w32.h"
|
||||
# include "Zend/zend_config.w32.h"
|
||||
#else
|
||||
# include "main/php_config.h"
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// vim:ft=javascript
|
||||
|
||||
ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_win32.c");
|
||||
ADD_SOURCES("TSRM", "TSRM.c tsrm_win32.c");
|
||||
ADD_FLAG("CFLAGS_BD_TSRM", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
@@ -1,14 +0,0 @@
|
||||
#ifndef TSRM_CONFIG_W32_H
|
||||
#define TSRM_CONFIG_W32_H
|
||||
|
||||
#include <../main/config.w32.h>
|
||||
#include "Zend/zend_config.w32.h"
|
||||
|
||||
#define HAVE_UTIME 1
|
||||
#define HAVE_ALLOCA 1
|
||||
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
|
||||
#endif
|
||||
@@ -1,69 +0,0 @@
|
||||
#ifndef TSRM_CONFIG_COMMON_H
|
||||
#define TSRM_CONFIG_COMMON_H
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
# ifdef _WIN32
|
||||
# define TSRM_WIN32
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
# include "tsrm_config.w32.h"
|
||||
#else
|
||||
# include "main/php_config.h"
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_ALLOCA_H && !defined(_ALLOCA_H)
|
||||
# include <alloca.h>
|
||||
#endif
|
||||
|
||||
/* AIX requires this to be the first thing in the file. */
|
||||
#ifndef __GNUC__
|
||||
# ifndef HAVE_ALLOCA_H
|
||||
# ifdef _AIX
|
||||
#pragma alloca
|
||||
# else
|
||||
# ifndef alloca /* predefined by HP cc +Olibcalls */
|
||||
char *alloca ();
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
# if _WIN32
|
||||
# include "win32/ioutil.h"
|
||||
# define MAXPATHLEN PHP_WIN32_IOUTIL_MAXPATHLEN
|
||||
# elif PATH_MAX
|
||||
# define MAXPATHLEN PATH_MAX
|
||||
# elif defined(MAX_PATH)
|
||||
# define MAXPATHLEN MAX_PATH
|
||||
# else
|
||||
# define MAXPATHLEN 256
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2))
|
||||
# define TSRM_ALLOCA_MAX_SIZE 4096
|
||||
# define TSRM_ALLOCA_FLAG(name) \
|
||||
int name;
|
||||
# define tsrm_do_alloca_ex(size, limit, use_heap) \
|
||||
((use_heap = ((size) > (limit))) ? malloc(size) : alloca(size))
|
||||
# define tsrm_do_alloca(size, use_heap) \
|
||||
tsrm_do_alloca_ex(size, TSRM_ALLOCA_MAX_SIZE, use_heap)
|
||||
# define tsrm_free_alloca(p, use_heap) \
|
||||
do { if (use_heap) free(p); } while (0)
|
||||
#else
|
||||
# define TSRM_ALLOCA_FLAG(name)
|
||||
# define tsrm_do_alloca(p, use_heap) malloc(p)
|
||||
# define tsrm_free_alloca(p, use_heap) free(p)
|
||||
#endif
|
||||
|
||||
#endif /* TSRM_CONFIG_COMMON_H */
|
||||
@@ -1,63 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "tsrm_config_common.h"
|
||||
#include "tsrm_strtok_r.h"
|
||||
|
||||
static inline int in_character_class(char ch, const char *delim)
|
||||
{/*{{{*/
|
||||
while (*delim) {
|
||||
if (*delim == ch) {
|
||||
return 1;
|
||||
}
|
||||
delim++;
|
||||
}
|
||||
return 0;
|
||||
}/*}}}*/
|
||||
|
||||
TSRM_API char *tsrm_strtok_r(char *s, const char *delim, char **last)
|
||||
{/*{{{*/
|
||||
char *token;
|
||||
|
||||
if (s == NULL) {
|
||||
s = *last;
|
||||
}
|
||||
|
||||
while (*s && in_character_class(*s, delim)) {
|
||||
s++;
|
||||
}
|
||||
if (!*s) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
token = s;
|
||||
|
||||
while (*s && !in_character_class(*s, delim)) {
|
||||
s++;
|
||||
}
|
||||
if (!*s) {
|
||||
*last = s;
|
||||
} else {
|
||||
*s = '\0';
|
||||
*last = s + 1;
|
||||
}
|
||||
return token;
|
||||
}/*}}}*/
|
||||
|
||||
#if 0
|
||||
|
||||
main()
|
||||
{
|
||||
char foo[] = "/foo/bar//\\barbara";
|
||||
char *last;
|
||||
char *token;
|
||||
|
||||
token = tsrm_strtok_r(foo, "/\\", &last);
|
||||
while (token) {
|
||||
printf ("Token = '%s'\n", token);
|
||||
token = tsrm_strtok_r(NULL, "/\\", &last);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef TSRM_STRTOK_R
|
||||
#define TSRM_STRTOK_R
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
TSRM_API char *tsrm_strtok_r(char *s, const char *delim, char **last);
|
||||
|
||||
#endif
|
||||
+1
-1
@@ -769,7 +769,7 @@ static zend_always_inline void UnixTimeToFileTime(time_t t, LPFILETIME pft) /* {
|
||||
// Note that LONGLONG is a 64-bit value
|
||||
LONGLONG ll;
|
||||
|
||||
ll = t * 10000000 + 116444736000000000;
|
||||
ll = t * 10000000LL + 116444736000000000LL;
|
||||
pft->dwLowDateTime = (DWORD)ll;
|
||||
pft->dwHighDateTime = ll >> 32;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,10 @@ PHP 7.4 UPGRADE NOTES
|
||||
========================================
|
||||
|
||||
- Core:
|
||||
. Trying to use values of type null, bool, int, float or resource as an
|
||||
array (such as $null["key"]) will now generate a notice. This does not
|
||||
affect array accesses performed by list().
|
||||
RFC: https://wiki.php.net/rfc/notice-for-non-valid-array-container
|
||||
. get_declared_classes() no longer returns anonymous classes that haven't
|
||||
been instantiated yet.
|
||||
. "fn" is now a reserved keyword. In particular it can no longer be used as a
|
||||
@@ -30,7 +34,10 @@ PHP 7.4 UPGRADE NOTES
|
||||
. Passing the result of a (non-reference) list() assignment by reference is
|
||||
consistently disallowed now. Previously this worked if the right hand side
|
||||
was a simple (CV) variable and did not occur as part of the list().
|
||||
. Added --ini-path and --ini-dir options to php-config.
|
||||
. `<?php` at the end of the file (without trailing newline) will now be
|
||||
interpreted as an opening PHP tag. Previously it was interpreted either as
|
||||
`<? php` and resulted in a syntax error (with short_open_tag=1) or was
|
||||
interpreted as a literal `<?php` string (with short_open_tag=0).
|
||||
|
||||
- BCMath:
|
||||
. BCMath functions will now warn if a non well-formed number is passed, such
|
||||
@@ -65,8 +72,8 @@ PHP 7.4 UPGRADE NOTES
|
||||
- Openssl:
|
||||
. The openssl_random_pseudo_bytes() function will now throw an exception in
|
||||
error situations, similar to random_bytes(). In particular, an Error is
|
||||
thrown if the number of requested bytes is smaller *or equal* than zero,
|
||||
and an Exception is thrown is sufficient randomness cannot be gathered.
|
||||
thrown if the number of requested bytes is less than *or equal to* zero,
|
||||
and an Exception is thrown if sufficient randomness cannot be gathered.
|
||||
The $crypto_strong output argument is guaranteed to always be true if the
|
||||
function does not throw, so explicitly checking it is not necessary.
|
||||
RFC: http://php.net/manual/de/function.openssl-random-pseudo-bytes.php
|
||||
@@ -128,6 +135,19 @@ PHP 7.4 UPGRADE NOTES
|
||||
Applications correctly using the constants PASSWORD_DEFAULT,
|
||||
PASSWORD_BCRYPT, PASSWORD_ARGON2I, and PASSWORD_ARGON2ID will continue to
|
||||
function correctly.
|
||||
. htmlentities() will now throw a notice (instead of a strict standards
|
||||
warning) if it is used with an encoding for which only basic entity
|
||||
substitution is supported, in which case it is equivalent to
|
||||
htmlspecialchars().
|
||||
. fread() and fwrite() will now return false if the operation failed.
|
||||
Previously an empty string or 0 was returned. EAGAIN/EWOULDBLOCK are not
|
||||
considered failures.
|
||||
. fread() and fwrite() on plain files will now throw a notice on failure,
|
||||
such as when trying to write to a read-only file resource.
|
||||
|
||||
- Tokenizer:
|
||||
. token_get_all() will now emit a T_BAD_CHARACTER token for unexpected
|
||||
characters instead of leaving behind holes in the token stream.
|
||||
|
||||
========================================
|
||||
2. New Features
|
||||
@@ -141,7 +161,7 @@ PHP 7.4 UPGRADE NOTES
|
||||
public string $name;
|
||||
}
|
||||
|
||||
This will enforce that $user->id can only be assigned integer and
|
||||
This will enforce that $user->id can only be assigned integers and
|
||||
$user->name can only be assigned strings. For more information see the
|
||||
RFC: https://wiki.php.net/rfc/typed_properties_v2
|
||||
|
||||
@@ -226,7 +246,7 @@ PHP 7.4 UPGRADE NOTES
|
||||
|
||||
imagefilter($im, IMG_FILTER_SCATTER, int $sub, int $plus, array $colors = []);
|
||||
|
||||
The $colors array can be populated with a set of indexed colors where to
|
||||
The $colors array can be populated with a set of indexed colors to
|
||||
apply the scatter pixel shifting on.
|
||||
|
||||
Note, the result of this filter is always random.
|
||||
@@ -236,7 +256,7 @@ PHP 7.4 UPGRADE NOTES
|
||||
used by storage systems, such as iSCSI, SCTP, Btrfs and ext4.
|
||||
|
||||
- Mbstring:
|
||||
. Added mb_str_split() function, which provide the same functionality as
|
||||
. Added mb_str_split() function, which provides the same functionality as
|
||||
str_split(), but operating on code points rather than bytes.
|
||||
RFC: https://wiki.php.net/rfc/mb_str_split
|
||||
|
||||
@@ -262,8 +282,8 @@ PHP 7.4 UPGRADE NOTES
|
||||
. PDOStatement::getColumnMeta() is now available
|
||||
|
||||
- PDO_SQLite:
|
||||
. PDOStatement::getAttribute(PDO::SQLITE_ATTR_READONLY_STATEMENT) allows to
|
||||
check whether this statement is read-only, i.e. whether it doesn't modify
|
||||
. PDOStatement::getAttribute(PDO::SQLITE_ATTR_READONLY_STATEMENT) allows
|
||||
checking whether the statement is read-only, i.e. if it doesn't modify
|
||||
the database.
|
||||
. PDO::setAttribute(PDO::SQLITE_ATTR_EXTENDED_RESULT_CODES, true) enables the
|
||||
use of SQLite3 extended result codes in errorInfo().
|
||||
@@ -302,6 +322,13 @@ PHP 7.4 UPGRADE NOTES
|
||||
|
||||
proc_open(['php', '-r', 'echo "Hello World\n";'], $descriptors, $pipes);
|
||||
|
||||
. proc_open() now supports "redirect" and "null" descriptors. For example:
|
||||
|
||||
// Like 2>&1 on the shell
|
||||
proc_open($cmd, [1 => ['pipe', 'w'], 2 => ['redirect', 1]], $pipes);
|
||||
// Like 2>/dev/null or 2>nul on the shell
|
||||
proc_open($cmd, [1 => ['pipe', 'w'], 2 => ['null']], $pipes);
|
||||
|
||||
. password_hash() has argon2i(d) implementations from ext/sodium when PHP is
|
||||
built without libargon.
|
||||
|
||||
@@ -326,22 +353,35 @@ PHP 7.4 UPGRADE NOTES
|
||||
$a ? $b : ($c ? $d : $e)
|
||||
|
||||
RFC: https://wiki.php.net/rfc/ternary_associativity
|
||||
. The array and string offset access syntax using curly braces is deprecated.
|
||||
Use $str[$idx] instead of $str{$idx}.
|
||||
RFC: https://wiki.php.net/rfc/deprecate_curly_braces_array_access
|
||||
. The (real) cast is deprecated, use (float) instead.
|
||||
. Unbinding $this of a non-static method through a combination of
|
||||
ReflectionMethod::getClosure() and closure rebinding is deprecated. Doing
|
||||
so is equivalent to calling a non-static method statically, which has been
|
||||
deprecated since PHP 7.0.
|
||||
. Using "parent" inside a class without parent is deprecated, and will throw
|
||||
. Unbinding $this of a non-static closure is deprecated.
|
||||
. Using "parent" inside a class without a parent is deprecated, and will throw
|
||||
a compile-time error in the future. Currently an error will only be
|
||||
generated if/when the parent is accessed at run-time.
|
||||
. The allow_url_include ini directive is deprecated. Enabling it will generate
|
||||
a deprecation notice at startup.
|
||||
|
||||
- COM:
|
||||
. Importing type libraries with case-insensitive constant registering has been
|
||||
deprecated.
|
||||
|
||||
- Filter:
|
||||
. FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES
|
||||
instead.
|
||||
|
||||
- Mbstring:
|
||||
. Passing a non-string pattern to mb_ereg_replace() is deprecated. Currently
|
||||
non-string patterns are interpreted as ASCII codepoints. In PHP 8 the
|
||||
pattern will be interpreted as a string instead.
|
||||
. Passing the encoding as 3rd parameter to mb_strrpos() is deprecated. Instead
|
||||
pass a 0 offset and encoding as 4th parameter.
|
||||
|
||||
- LDAP:
|
||||
. ldap_control_paged_result_response and ldap_control_paged_result are
|
||||
@@ -352,6 +392,13 @@ PHP 7.4 UPGRADE NOTES
|
||||
This method has been deprecated in favor of ReflectionNamedType::getName()
|
||||
in the documentation since PHP 7.1, but did not throw a deprecation notice
|
||||
for technical reasons.
|
||||
. The export() methods on all Reflection classes are deprecated. Construct a
|
||||
Reflection object and convert it to string instead:
|
||||
|
||||
// ReflectionClass::export(Foo::class, false) is:
|
||||
echo new ReflectionClass(Foo::class), "\n";
|
||||
// $str = ReflectionClass::export(Foo::class, true) is:
|
||||
$str = (string) new ReflectionClass(Foo::class);
|
||||
|
||||
- Standard:
|
||||
. Passing invalid characters to ''base_convert()'', ''bindec()'', ''octdec()''
|
||||
@@ -359,6 +406,22 @@ PHP 7.4 UPGRADE NOTES
|
||||
still be computed as if the invalid characters did not exist. Leading and
|
||||
trailing whitespace, as well as prefixes of type 0x (depending on base)
|
||||
continue to be allowed.
|
||||
. Using array_key_exists() on objects is deprecated. Instead either isset()
|
||||
or property_exists() should be used.
|
||||
. The is_real() function is deprecated, use is_float() instead.
|
||||
. The get_magic_quotes_gpc() and get_magic_quotes_runtime() functions are
|
||||
deprecated. They always return false.
|
||||
. The hebrevc() function is deprecated. It can be replaced with
|
||||
nl2br(hebrev($str)), or preferably the use of Unicode RTL support.
|
||||
. The convert_cyr_string() function is deprecated. It can be replaced by one
|
||||
of mb_convert_string(), iconv() or UConverter.
|
||||
. The money_format() function is deprecated. It can be replaced by the
|
||||
intl NumberFormatter functionality.
|
||||
. The ezmlm_hash() function is deprecated.
|
||||
. The restore_include_path() function is deprecated. It can be replaced by
|
||||
ini_restore('include_path').
|
||||
. Passing parameters to implode() in reverse order is deprecated, use
|
||||
implode($glue, $parts) instead of implode($parts, $glue).
|
||||
|
||||
========================================
|
||||
5. Changed Functions
|
||||
@@ -392,7 +455,7 @@ PHP 7.4 UPGRADE NOTES
|
||||
ArrayObject.
|
||||
|
||||
- GD:
|
||||
. Added imagecreatefromtga() function, which allows to read images in TGA
|
||||
. Added imagecreatefromtga() function, which allows reading images in TGA
|
||||
format. TGA support is now also indicated by gd_info() and imagetypes().
|
||||
Note that TGA images are not recognized by imagecreatefromstring() and
|
||||
getimagesize().
|
||||
@@ -404,22 +467,22 @@ PHP 7.4 UPGRADE NOTES
|
||||
See <https://github.com/php/php-src/pull/3624>.
|
||||
|
||||
- Pcntl:
|
||||
. Added bool pcntl_unshare(int flags) function which allows to dissociate
|
||||
. Added bool pcntl_unshare(int flags) function which allows dissociating
|
||||
parts of the process execution context which are currently being shared with
|
||||
other processes. Explicitly, it allows you to unshare the mount, IPC, UTS,
|
||||
network, PID, user and cgroup namespaces.
|
||||
|
||||
- SQLite3:
|
||||
. Added SQLite3Stmt::getSQL() to retrieve the SQL of the statement. If TRUE is
|
||||
passed as parameter, query parameters will be replaced in the return value
|
||||
by their currently bound value, if libsqlite ≥ 3.14 is used.
|
||||
. Added SQLite3Stmt::getSQL() to retrieve the SQL of the statement. If true is
|
||||
passed as $expanded argument, query parameters will be replaced in the
|
||||
return value by their currently bound value, if libsqlite ≥ 3.14 is used.
|
||||
. Added SQLite3::backup() to create database backups via the SQLite3 online
|
||||
backup API.
|
||||
|
||||
- Standard
|
||||
. bool sapi_windows_set_ctrl_handler(callable handler, [, bool add = true]) -
|
||||
set or remove a handler function upon receiving a CTRL event. The handler
|
||||
function is expected have a signature "function handler(int $event)".
|
||||
function is expected to have this signature: "function handler(int $event)".
|
||||
. bool sapi_windows_generate_ctrl_event(int type, int pid) - send a CTRL event
|
||||
to another process.
|
||||
. array password_algos() - return a complete list of all registered password
|
||||
@@ -445,6 +508,11 @@ PHP 7.4 UPGRADE NOTES
|
||||
extension. For more details see the RFC:
|
||||
https://wiki.php.net/rfc/deprecate-and-remove-ext-interbase
|
||||
|
||||
- Recode:
|
||||
. The recode extension has been moved to PECL. For character set/encoding
|
||||
conversion the iconv or mbstring extensions could be used instead.
|
||||
RFC: https://wiki.php.net/rfc/unbundle_recode
|
||||
|
||||
- WDDX:
|
||||
. The WDDX extension has been deprecated and moved to PECL.
|
||||
RFC: https://wiki.php.net/rfc/deprecate-and-remove-ext-wddx
|
||||
@@ -468,8 +536,8 @@ PHP 7.4 UPGRADE NOTES
|
||||
can now reliably be built as shared when using ./configure once more.
|
||||
|
||||
- Hash:
|
||||
. The hash extension cannot be disabled anymore and is always an integral
|
||||
part of any PHP build, similar to the date extension.
|
||||
. The hash extension cannot be disabled anymore and is always an integral part
|
||||
of any PHP build, similar to the date extension.
|
||||
|
||||
- Intl:
|
||||
. The Intl extension now requires at least ICU 50.1.
|
||||
@@ -487,6 +555,13 @@ PHP 7.4 UPGRADE NOTES
|
||||
. The --disable-opcache-file|--enable-opcache-file configure options have been
|
||||
removed in favor of the opcache.file_cache INI directive.
|
||||
|
||||
- PDO:
|
||||
. It is now possible to escape question marks in SQL queries to avoid them
|
||||
being interpreted as parameter placeholders. Writing "??" allows sending
|
||||
a single question mark to the database and e.g. use the PostgreSQL JSON key
|
||||
exists "?" operator. For more details see the RFC:
|
||||
https://wiki.php.net/rfc/pdo_escape_placeholders
|
||||
|
||||
- Reflection:
|
||||
. Numeric value of class, property, function and constant modifiers was
|
||||
changed. Don't filter methods and properties through
|
||||
@@ -498,9 +573,9 @@ PHP 7.4 UPGRADE NOTES
|
||||
. SimpleXMLElement now implements Countable.
|
||||
|
||||
- SQLite3:
|
||||
. The bundled libsqlite has been removed. To build the SQLite3 extension
|
||||
a system libsqlite3 ≥ 3.7.4 is now required. To build the PDO_SQLite
|
||||
extension a system libsqlite3 ≥ 3.5.0 is now required.
|
||||
. The bundled libsqlite has been removed. To build the SQLite3 extension a
|
||||
system libsqlite3 ≥ 3.7.4 is now required. To build the PDO_SQLite extension
|
||||
a system libsqlite3 ≥ 3.5.0 is now required.
|
||||
. (Un)serialization of SQLite3, SQLite3Stmt and SQLite3Result is now
|
||||
explicitly forbidden. Formerly, serialization of instances of these classes
|
||||
was possible, but unserialization yielded unusable objects.
|
||||
@@ -565,7 +640,7 @@ PHP 7.4 UPGRADE NOTES
|
||||
========================================
|
||||
|
||||
- zend.exception_ignore_args
|
||||
. New INI directive which displays or hides arguments from the stack traces
|
||||
. New INI directive to include or exclude arguments from stack traces
|
||||
generated for exceptions.
|
||||
|
||||
========================================
|
||||
@@ -577,9 +652,9 @@ PHP 7.4 UPGRADE NOTES
|
||||
- An inode number is delivered and is based on the NTFS file index.
|
||||
- The device number is now based on the volume serial number.
|
||||
|
||||
Note, that both values derived from the system and provided as is on 64-bit
|
||||
systems. On 32-bit system, these values might overflow the 32-bit integer in
|
||||
PHP, so they're a fake.
|
||||
Note that both values are derived from the system and provided as is on 64-bit
|
||||
systems. On 32-bit systems, these values might overflow the 32-bit integer in
|
||||
PHP, so they're fake.
|
||||
|
||||
- CTRL+C and CTRL+BREAK on console can be caught by setting a handler function
|
||||
with sapi_windows_set_ctrl_handler().
|
||||
@@ -587,16 +662,19 @@ PHP 7.4 UPGRADE NOTES
|
||||
- configure now regards additional CFLAGS and LDFLAGS set as environment
|
||||
variables.
|
||||
|
||||
- OPcache now supports an arbitrary amount of separate caches per user via the
|
||||
the INI directive opcache.cache_id. All processes with the same cache ID and
|
||||
user share an OPcache instance.
|
||||
|
||||
========================================
|
||||
13. Migration to pkg-config
|
||||
========================================
|
||||
|
||||
A number of extensions have been migrated to exclusively use pkg-config for
|
||||
the detection of library dependencies. Generally, this means that instead of
|
||||
using --with-foo-dir=DIR or similar only --with-foo is used. Custom library
|
||||
paths can be specified either by adding additional directories to
|
||||
PKG_CONFIG_PATH or by explicitly specifying compilation options through
|
||||
FOO_CFLAGS and FOO_LIBS.
|
||||
A number of extensions have been migrated to exclusively use pkg-config for the
|
||||
detection of library dependencies. Generally, this means that instead of using
|
||||
--with-foo-dir=DIR or similar only --with-foo is used. Custom library paths can
|
||||
be specified either by adding additional directories to PKG_CONFIG_PATH or by
|
||||
explicitly specifying compilation options through FOO_CFLAGS and FOO_LIBS.
|
||||
|
||||
The following extensions and SAPIs are affected:
|
||||
|
||||
@@ -634,8 +712,8 @@ The following extensions and SAPIs are affected:
|
||||
- Libxml:
|
||||
. --with-libxml-dir has been removed.
|
||||
. --enable-libxml becomes --with-libxml.
|
||||
. --with-libexpat-dir has been renamed to --with-expat and no longer
|
||||
accepts a directory.
|
||||
. --with-libexpat-dir has been renamed to --with-expat and no longer accepts a
|
||||
directory.
|
||||
|
||||
- LiteSpeed:
|
||||
. --with-litespeed becomes --enable-litespeed.
|
||||
@@ -646,7 +724,7 @@ The following extensions and SAPIs are affected:
|
||||
|
||||
- ODBC:
|
||||
. --with-iodbc no longer accepts a directory.
|
||||
. --with-unixODBC without directory now use pkg-config (preferred).
|
||||
. --with-unixODBC without a directory now uses pkg-config (preferred).
|
||||
Directory is still accepted for old versions without libodbc.pc.
|
||||
|
||||
- OpenSSL:
|
||||
@@ -680,10 +758,6 @@ The following extensions and SAPIs are affected:
|
||||
14. Other Changes
|
||||
========================================
|
||||
|
||||
- Core:
|
||||
. Add zend.exception_ignore_args to force the omission of arguments from
|
||||
stack traces collected for exceptions.
|
||||
|
||||
========================================
|
||||
15. Performance Improvements
|
||||
========================================
|
||||
|
||||
+19
-3
@@ -23,7 +23,9 @@ PHP 7.4 INTERNALS UPGRADE NOTES
|
||||
t. Exceptions thrown by string conversions.
|
||||
u. Removed uint and ulong typedefs
|
||||
v. Compound assignment opcodes
|
||||
z. APACHE symbol removed
|
||||
w. APACHE symbol removed
|
||||
x. php_error_docref0() renamed to php_error_docref()
|
||||
y. Stream wrapper read/write ops
|
||||
|
||||
2. Build system changes
|
||||
a. Abstract
|
||||
@@ -220,7 +222,12 @@ PHP 7.4 INTERNALS UPGRADE NOTES
|
||||
ZEND_ASSIGN_DIM_OP, ZEND_ASSIGN_OBJ_OP and ZEND_ASSIGN_STATIC_PROP_OP with
|
||||
ZEND_ADD (or other) in extended_value.
|
||||
|
||||
z. APACHE symbol has been removed and is no longer defined.
|
||||
w. APACHE symbol has been removed and is no longer defined.
|
||||
|
||||
x. php_error_docref0() has been removed and renamed to php_error_docref().
|
||||
|
||||
y. The read and write operations of php_stream_ops now return ssize_t, with
|
||||
negative values indicating an error.
|
||||
|
||||
========================
|
||||
2. Build system changes
|
||||
@@ -247,8 +254,12 @@ PHP 7.4 INTERNALS UPGRADE NOTES
|
||||
PHP_SOLID_LIBS, PHP_EMPRESS_INCLUDE, PHP_EMPRESS_LIBS, PHP_SYBASE_INCLUDE,
|
||||
PHP_SYBASE_LFLAGS, PHP_SYBASE_LIBS, PHP_DBM_TYPE, PHP_DBM_LIB,
|
||||
PHP_LDAP_LFLAGS, PHP_LDAP_INCLUDE, PHP_LDAP_LIBS.
|
||||
- Removed unused symbols: HAVE_CURL_EASY_STRERROR, HAVE_CURL_MULTI_STRERROR,
|
||||
HAVE_MPIR, HAVE_MBSTR_CN, HAVE_MBSTR_JA, HAVE_MBSTR_KR, HAVE_MBSTR_RU,
|
||||
HAVE_MBSTR_TW.
|
||||
|
||||
b. Unix build system changes
|
||||
- Added --ini-path and --ini-dir options to php-config.
|
||||
- configure --help now also outputs --program-suffix and --program-prefix
|
||||
information by using the Autoconf AC_ARG_PROGRAM macro.
|
||||
- Obsolescent macros AC_FUNC_VPRINTF and AC_FUNC_UTIME_NULL have been
|
||||
@@ -285,7 +296,9 @@ PHP 7.4 INTERNALS UPGRADE NOTES
|
||||
- Removed unused check for dev/arandom and the HAVE_DEV_ARANDOM symbol.
|
||||
- Remove unused functions checks: HAVE_MBSINIT, HAVE_MEMPCPY, HAVE_SETPGID,
|
||||
HAVE_STRPNCPY, HAVE_STRTOULL, HAVE_VSNPRINTF, HAVE_CUSERID, HAVE_LRAND48,
|
||||
HAVE_RANDOM, HAVE_SRAND48, HAVE_SRANDOM, HAVE_STRDUP.
|
||||
HAVE_RANDOM, HAVE_SRAND48, HAVE_SRANDOM, HAVE_STRDUP, HAVE_GCVT,
|
||||
HAVE_ISASCII, HAVE_LINK, HAVE_LOCKF, HAVE_SOCKOPT, HAVE_SETVBUF, HAVE_SIN,
|
||||
HAVE_TEMPNAM.
|
||||
- Unused check for struct cmsghdr and symbol HAVE_CMSGHDR have been removed.
|
||||
- Unused ApplicationServices/ApplicationServices.h headers check and
|
||||
HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H symbol have been removed.
|
||||
@@ -293,10 +306,13 @@ PHP 7.4 INTERNALS UPGRADE NOTES
|
||||
- PHP_CHECK_CONFIGURE_OPTIONS macro has been removed. Default Autoconf's
|
||||
--enable-option-checking=fatal option can be used in the configure step
|
||||
to enable error when invalid options are used.
|
||||
- Removed unused check and symbols HAVE_SHM_MMAP_ZERO, HAVE_SHM_MMAP_FILE.
|
||||
- Removed unused check and symbol MISSING_MSGHDR_MSGFLAGS.
|
||||
|
||||
c. Windows build system changes
|
||||
|
||||
. Visual Studio 2019 is utilized for the Windows builds
|
||||
. Removed unused defined symbol HAVE_LIBBIND.
|
||||
|
||||
========================
|
||||
3. Module changes
|
||||
|
||||
+2
-4
@@ -306,10 +306,8 @@ AC_ARG_ENABLE([zend-signals],
|
||||
[ZEND_SIGNALS=$enableval],
|
||||
[ZEND_SIGNALS=yes])
|
||||
|
||||
AC_CHECK_FUNC(sigaction, [
|
||||
AC_DEFINE(HAVE_SIGACTION, 1, [Whether sigaction() is available])
|
||||
], [
|
||||
ZEND_SIGNALS=no
|
||||
AC_CHECK_FUNCS([sigaction], [], [
|
||||
ZEND_SIGNALS=no
|
||||
])
|
||||
if test "$ZEND_SIGNALS" = "yes"; then
|
||||
AC_DEFINE(ZEND_SIGNALS, 1, [Use zend signal handling])
|
||||
|
||||
+10
-4
@@ -16,19 +16,23 @@ var_dump($a->$b->{$c[1]});
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Undefined variable: %s in %s on line %d
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
|
||||
Notice: Undefined variable: %s in %s on line %d
|
||||
Notice: Undefined variable: c in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
int(1)
|
||||
|
||||
Notice: Undefined variable: %s in %s on line %d
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
|
||||
Notice: Undefined variable: %s in %s on line %d
|
||||
Notice: Undefined variable: b in %s on line %d
|
||||
int(0)
|
||||
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
@@ -45,6 +49,8 @@ NULL
|
||||
|
||||
Notice: Undefined variable: c in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to get property '1' of non-object in %s on line %d
|
||||
|
||||
Notice: Trying to get property '' of non-object in %s on line %d
|
||||
|
||||
+31
-1
@@ -19,10 +19,40 @@ $arr[][]->bar = 2;
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: arr in %s on line %d
|
||||
|
||||
Notice: Undefined variable: arr in %s on line %d
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Undefined variable: arr in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Undefined variable: arr in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to get property 'foo' of non-object in %s on line %d
|
||||
|
||||
Warning: Creating default object from empty value in %s on line %d
|
||||
|
||||
@@ -8,6 +8,9 @@ $a{function() { }} = 1;
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
|
||||
|
||||
Warning: Illegal offset type in %s on line %d
|
||||
|
||||
Warning: Illegal offset type in %s on line %d
|
||||
@@ -12,7 +12,8 @@ var_dump($var1);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Notice: Trying to access array offset on value of type float in %s on line %d
|
||||
NULL
|
||||
NULL
|
||||
Done
|
||||
@@ -3,7 +3,7 @@ Bug #33771 (error_reporting falls to 0 when @ was used inside try/catch block)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
var_dump(error_reporting());
|
||||
|
||||
@@ -14,7 +14,7 @@ function make_exception()
|
||||
|
||||
function make_exception_and_change_err_reporting()
|
||||
{
|
||||
error_reporting(E_ALL & ~E_STRICT);
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
@@ -36,5 +36,5 @@ echo "Done\n";
|
||||
--EXPECT--
|
||||
int(32767)
|
||||
int(32767)
|
||||
int(30719)
|
||||
int(32759)
|
||||
Done
|
||||
@@ -22,6 +22,9 @@ class Loader {
|
||||
function stream_stat() {
|
||||
return array('size' => strlen($this->data));
|
||||
}
|
||||
function stream_set_option($option, $arg1, $arg2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
stream_wrapper_register('Loader', 'Loader');
|
||||
require 'Loader://qqq.php';
|
||||
|
||||
@@ -19,7 +19,7 @@ class x extends c implements a, b {
|
||||
function foo() { }
|
||||
}
|
||||
|
||||
ReflectionClass::export('x');
|
||||
echo new ReflectionClass('x');
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Bug #52160 (Invalid E_STRICT redefined constructor error)
|
||||
Bug #52160 (Invalid E_DEPRECATED redefined constructor error)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Bug #62956: "incompatible" signatures for private methods should not cause E_STRICT
|
||||
Bug #62956: "incompatible" signatures for private methods should not cause E_WARNING
|
||||
--FILE--
|
||||
<?php
|
||||
class Base
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Bug #64988 (Class loading order affects E_STRICT warning)
|
||||
Bug #64988 (Class loading order affects E_WARNING warning)
|
||||
--FILE--
|
||||
<?php
|
||||
abstract class Base1 {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
bug67436: E_STRICT instead of custom error handler
|
||||
bug67436: E_WARNING instead of custom error handler
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ Bug #71572: String offset assignment from an empty string inserts null byte
|
||||
<?php
|
||||
|
||||
$str = "abc";
|
||||
var_dump($str{0} = "");
|
||||
var_dump($str{1} = "");
|
||||
var_dump($str{3} = "");
|
||||
var_dump($str{10} = "");
|
||||
var_dump($str[0] = "");
|
||||
var_dump($str[1] = "");
|
||||
var_dump($str[3] = "");
|
||||
var_dump($str[10] = "");
|
||||
var_dump($str);
|
||||
?>
|
||||
==DONE==
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
--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
|
||||
@@ -0,0 +1,27 @@
|
||||
--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
|
||||
@@ -0,0 +1,54 @@
|
||||
--TEST--
|
||||
Bug #78340: Include of stream wrapper not reading whole file
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class lib {
|
||||
public static $files= [];
|
||||
|
||||
private $bytes, $pos;
|
||||
|
||||
function stream_open($path, $mode, $options, $opened_path) {
|
||||
$this->bytes= self::$files[$path];
|
||||
$this->pos= 0;
|
||||
$this->ino= crc32($path);
|
||||
return true;
|
||||
}
|
||||
|
||||
function stream_read($count) {
|
||||
$chunk= substr($this->bytes, $this->pos, $count);
|
||||
$this->pos+= strlen($chunk);
|
||||
return $chunk;
|
||||
}
|
||||
|
||||
function stream_eof() {
|
||||
return $this->pos >= strlen($this->bytes);
|
||||
}
|
||||
|
||||
function stream_close() {
|
||||
$this->bytes= null;
|
||||
}
|
||||
|
||||
function stream_stat() {
|
||||
return [
|
||||
'dev' => 3632233996,
|
||||
'size' => strlen($this->bytes),
|
||||
'ino' => $this->ino
|
||||
];
|
||||
}
|
||||
|
||||
function stream_set_option($option, $arg1, $arg2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$fill = str_repeat('.', 8192);
|
||||
lib::$files['lib://test.php']= '<?php /* '.$fill.' */ function test() { echo "Works!\n"; }';
|
||||
stream_wrapper_register('lib', lib::class);
|
||||
|
||||
include('lib://test.php');
|
||||
test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Works!
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #78344: Segmentation fault on zend_check_protected
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
protected const FOO = 1;
|
||||
}
|
||||
|
||||
class B {}
|
||||
class C extends B {
|
||||
public function method() {
|
||||
var_dump(A::FOO);
|
||||
}
|
||||
}
|
||||
(new C)->method();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Cannot access protected const A::FOO in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): C->method()
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #78356: Array returned from ArrayAccess is incorrectly unpacked as argument
|
||||
--FILE--
|
||||
<?php
|
||||
$object = new class implements ArrayAccess {
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return [1, 2];
|
||||
}
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public function offsetUnset($offset) {}
|
||||
public function offsetSet($offset, $value) {}
|
||||
};
|
||||
var_dump(max(...$object[0]));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2)
|
||||
Binary file not shown.
@@ -13,6 +13,8 @@ var_dump($a);
|
||||
--EXPECTF--
|
||||
Notice: Undefined offset: 0 in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Warning: Parameter 1 to foo() expected to be a reference, value given in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
@@ -80,6 +80,8 @@ scoped to A: bool(false)
|
||||
bound: no
|
||||
scoped to A: bool(true)
|
||||
bound: no
|
||||
|
||||
Deprecated: Unbinding $this of closure is deprecated in %s on line %d
|
||||
scoped to A: bool(true)
|
||||
bound: no
|
||||
After binding, with same-class instance for the bound ones
|
||||
|
||||
@@ -38,7 +38,7 @@ $d = $nonstaticUnscoped->bindTo(new A, 'A'); $d(); echo "\n";
|
||||
$d = $nonstaticScoped->bindTo(new A, 'A'); $d(); echo "\n";
|
||||
|
||||
echo "Done.\n";
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Before binding
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -50,6 +50,8 @@ After binding, null scope, no instance
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
|
||||
Deprecated: Unbinding $this of closure is deprecated in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
@@ -64,6 +66,8 @@ After binding, with scope, no instance
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
|
||||
Deprecated: Unbinding $this of closure is deprecated in %s on line %d
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ echo "After binding, with different instance for the bound one", "\n";
|
||||
$d = $nonstaticScoped->bindTo(new B, "static"); $d(); echo "\n";
|
||||
|
||||
echo "Done.\n";
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Before binding
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -50,6 +50,8 @@ After binding, no instance
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
|
||||
Deprecated: Unbinding $this of closure is deprecated in %s on line %d
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
|
||||
@@ -5,6 +5,12 @@ Constant expressions with null coalescing operator ??
|
||||
|
||||
const A = [1 => [[]]];
|
||||
|
||||
// should produce deprecation notices
|
||||
const D_1 = null ?? A[1]{'undefined'}['index'] ?? 1;
|
||||
const D_2 = null ?? A['undefined']{'index'} ?? 2;
|
||||
const D_3 = null ?? A[1]{0}{2} ?? 3; // 2 deprecation notices
|
||||
const D_4 = A[1]{0} ?? 4;
|
||||
|
||||
const T_1 = null ?? A[1]['undefined']['index'] ?? 1;
|
||||
const T_2 = null ?? A['undefined']['index'] ?? 2;
|
||||
const T_3 = null ?? A[1][0][2] ?? 3;
|
||||
@@ -12,6 +18,11 @@ const T_4 = A[1][0][2] ?? 4;
|
||||
const T_5 = null ?? __LINE__;
|
||||
const T_6 = __LINE__ ?? "bar";
|
||||
|
||||
var_dump(D_1);
|
||||
var_dump(D_2);
|
||||
var_dump(D_3);
|
||||
var_dump(D_4);
|
||||
|
||||
var_dump(T_1);
|
||||
var_dump(T_2);
|
||||
var_dump(T_3);
|
||||
@@ -31,6 +42,21 @@ var_dump((new class { public $var = A[1][0][2] ?? 4; })->var);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
|
||||
|
||||
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
|
||||
|
||||
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
|
||||
|
||||
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
|
||||
|
||||
Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
|
||||
int(1)
|
||||
int(2)
|
||||
int(3)
|
||||
array(0) {
|
||||
}
|
||||
int(1)
|
||||
int(2)
|
||||
int(3)
|
||||
|
||||
@@ -69,6 +69,8 @@ array(2) {
|
||||
int(5)
|
||||
}
|
||||
int(1)
|
||||
|
||||
Notice: Trying to access array offset on value of type int in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Undefined offset: 4 in %s on line %d
|
||||
|
||||
@@ -21,7 +21,10 @@ var_dump(b()[1]);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Trying to access array offset on value of type int in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type int in %s on line %d
|
||||
NULL
|
||||
|
||||
Fatal error: Uncaught Error: Cannot use object of type stdClass as array in %s:%d
|
||||
|
||||
@@ -27,8 +27,12 @@ var_dump($h);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to get property 'a' of non-object in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to get property 'b' of non-object in %s on line %d
|
||||
NULL
|
||||
@@ -3,13 +3,13 @@ testing @ and error_reporting - 2
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
|
||||
function foo($arg) {
|
||||
}
|
||||
|
||||
function bar() {
|
||||
error_reporting(E_ALL|E_STRICT);
|
||||
error_reporting(E_ALL);
|
||||
throw new Exception("test");
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ testing @ and error_reporting - 3
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
|
||||
function foo($arg) {
|
||||
echo @$nonex_foo;
|
||||
@@ -16,7 +16,7 @@ function bar() {
|
||||
|
||||
function foo1() {
|
||||
echo $undef1;
|
||||
error_reporting(E_ALL|E_STRICT);
|
||||
error_reporting(E_ALL);
|
||||
echo $undef2;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ testing @ and error_reporting - 4
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
|
||||
function foo() {
|
||||
echo $undef;
|
||||
error_reporting(E_ALL|E_STRICT);
|
||||
error_reporting(E_ALL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ testing @ and error_reporting - 8
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
|
||||
function foo1($arg) {
|
||||
}
|
||||
@@ -12,7 +12,7 @@ function foo2($arg) {
|
||||
}
|
||||
|
||||
function foo3() {
|
||||
error_reporting(E_ALL|E_STRICT);
|
||||
error_reporting(E_ALL);
|
||||
echo $undef3;
|
||||
throw new Exception("test");
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ testing @ and error_reporting - 9
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
|
||||
function bar() {
|
||||
echo @$blah;
|
||||
@@ -12,7 +12,7 @@ function bar() {
|
||||
|
||||
function foo() {
|
||||
echo @$undef;
|
||||
error_reporting(E_ALL|E_STRICT);
|
||||
error_reporting(E_ALL);
|
||||
echo $blah;
|
||||
return bar();
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ Throwing exception using a class that isn't derived from the Exception base clas
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL|E_STRICT);
|
||||
|
||||
class Foo { }
|
||||
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
get_class_vars() returns uninitialized typed properties with a null value
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
public static int $int1;
|
||||
public static int $int2 = 42;
|
||||
public int $int3;
|
||||
public int $int4 = 42;
|
||||
}
|
||||
|
||||
var_dump(get_class_vars(Test::class));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(4) {
|
||||
["int3"]=>
|
||||
NULL
|
||||
["int4"]=>
|
||||
int(42)
|
||||
["int1"]=>
|
||||
NULL
|
||||
["int2"]=>
|
||||
int(42)
|
||||
}
|
||||
@@ -33,6 +33,8 @@ Notice: Undefined variable: c in %s on line %d
|
||||
|
||||
Notice: Undefined variable: d in %s on line %d
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
|
||||
Notice: Trying to get property '' of non-object in %s on line %d
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
@@ -18,7 +18,7 @@ class B {
|
||||
}
|
||||
|
||||
$f = (new A)->f();
|
||||
var_dump($f->bindTo(null, 'B')());
|
||||
var_dump($f->bindTo(new B, 'B')());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
||||
@@ -24,14 +24,31 @@ var_dump($bool[$arr]);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Notice: Trying to access array offset on value of type bool in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type bool in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type bool in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type bool in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type bool in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type bool in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type bool in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type bool in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type bool in %s on line %d
|
||||
NULL
|
||||
Done
|
||||
@@ -24,14 +24,31 @@ var_dump($long[$arr]);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Notice: Trying to access array offset on value of type int in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type int in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type int in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type int in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type int in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type int in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type int in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type int in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type int in %s on line %d
|
||||
NULL
|
||||
Done
|
||||
@@ -24,14 +24,31 @@ var_dump($null[$arr]);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Trying to access array offset on value of type null in %s on line %d
|
||||
NULL
|
||||
Done
|
||||
@@ -0,0 +1 @@
|
||||
<?php
|
||||
@@ -0,0 +1,5 @@
|
||||
--TEST--
|
||||
File with just a <?php tag should be valid
|
||||
--FILE_EXTERNAL--
|
||||
php_tag_only.inc
|
||||
--EXPECT--
|
||||
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
The (real) cast is deprecated
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump((real) 42);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: The (real) cast is deprecated, use (float) instead in %s on line %d
|
||||
float(42)
|
||||
@@ -42,6 +42,7 @@ var_dump("\u{ffffff}");');
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0
|
||||
syntax error, unexpected end of file on line 2
|
||||
syntax error, unexpected end of file on line 3
|
||||
syntax error, unexpected end of file, expecting '(' on line 2
|
||||
|
||||
@@ -9,7 +9,7 @@ class A {
|
||||
}
|
||||
}
|
||||
|
||||
ReflectionClass::export("A");
|
||||
echo new ReflectionClass("A");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Class [ <user> class A ] {
|
||||
|
||||
@@ -8,31 +8,31 @@ $str = "abcdefghijklmno";
|
||||
$i = 3;
|
||||
$j = -4;
|
||||
|
||||
$str{2} = 'C';
|
||||
$str[2] = 'C';
|
||||
var_dump($str);
|
||||
|
||||
$str{$i} = 'Z';
|
||||
$str[$i] = 'Z';
|
||||
var_dump($str);
|
||||
|
||||
$str{-5} = 'P';
|
||||
$str[-5] = 'P';
|
||||
var_dump($str);
|
||||
|
||||
$str{$j} = 'Q';
|
||||
$str[$j] = 'Q';
|
||||
var_dump($str);
|
||||
|
||||
$str{-20} = 'Y';
|
||||
$str[-20] = 'Y';
|
||||
var_dump($str);
|
||||
|
||||
$str{-strlen($str)} = strtoupper($str{0}); /* An exotic ucfirst() ;) */
|
||||
$str[-strlen($str)] = strtoupper($str[0]); /* An exotic ucfirst() ;) */
|
||||
var_dump($str);
|
||||
|
||||
$str{20} = 'N';
|
||||
$str[20] = 'N';
|
||||
var_dump($str);
|
||||
|
||||
$str{-2} = 'UFO';
|
||||
$str[-2] = 'UFO';
|
||||
var_dump($str);
|
||||
|
||||
$str{-$i} = $str{$j*2};
|
||||
$str[-$i] = $str[$j*2];
|
||||
var_dump($str);
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
@@ -15,5 +15,6 @@ $my_var=array(1,2,3);
|
||||
$data = call_user_func_array("implode",array(&$my_var, new Test()));
|
||||
echo "Done.\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
|
||||
Done.
|
||||
@@ -1198,6 +1198,12 @@ ZEND_API int zend_update_class_constants(zend_class_entry *class_type) /* {{{ */
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
if (class_type->default_static_members_count && !CE_STATIC_MEMBERS(class_type)) {
|
||||
if (class_type->type == ZEND_INTERNAL_CLASS || (class_type->ce_flags & (ZEND_ACC_IMMUTABLE|ZEND_ACC_PRELOADED))) {
|
||||
zend_class_init_statics(class_type);
|
||||
}
|
||||
}
|
||||
|
||||
ce = class_type;
|
||||
while (ce) {
|
||||
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
|
||||
|
||||
@@ -76,6 +76,7 @@ typedef struct _zend_fcall_info_cache {
|
||||
#define ZEND_DEP_FALIAS(name, alias, arg_info) ZEND_FENTRY(name, ZEND_FN(alias), arg_info, ZEND_ACC_DEPRECATED)
|
||||
#define ZEND_NAMED_ME(zend_name, name, arg_info, flags) ZEND_FENTRY(zend_name, name, arg_info, flags)
|
||||
#define ZEND_ME(classname, name, arg_info, flags) ZEND_FENTRY(name, ZEND_MN(classname##_##name), arg_info, flags)
|
||||
#define ZEND_DEP_ME(classname, name, arg_info, flags) ZEND_ME(classname, name, arg_info, flags | ZEND_ACC_DEPRECATED)
|
||||
#define ZEND_ABSTRACT_ME(classname, name, arg_info) ZEND_FENTRY(name, NULL, arg_info, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
|
||||
#define ZEND_MALIAS(classname, name, alias, arg_info, flags) \
|
||||
ZEND_FENTRY(name, ZEND_MN(classname##_##alias), arg_info, flags)
|
||||
|
||||
+1
-1
@@ -714,7 +714,7 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
ret = FAILURE;
|
||||
} else {
|
||||
zend_fetch_dimension_const(result, &op1, &op2, (ast->attr == ZEND_DIM_IS) ? BP_VAR_IS : BP_VAR_R);
|
||||
zend_fetch_dimension_const(result, &op1, &op2, (ast->attr & ZEND_DIM_IS) ? BP_VAR_IS : BP_VAR_R);
|
||||
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
zval_ptr_dtor_nogc(&op2);
|
||||
|
||||
@@ -1123,12 +1123,17 @@ static void add_class_vars(zend_class_entry *scope, zend_class_entry *ce, int st
|
||||
} else if (!statics && (prop_info->flags & ZEND_ACC_STATIC) == 0) {
|
||||
prop = &ce->default_properties_table[OBJ_PROP_TO_NUM(prop_info->offset)];
|
||||
}
|
||||
if (!prop || Z_TYPE_P(prop) == IS_UNDEF) {
|
||||
if (!prop) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* copy: enforce read only access */
|
||||
ZVAL_COPY_OR_DUP(&prop_copy, prop);
|
||||
if (Z_ISUNDEF_P(prop)) {
|
||||
/* Return uninitialized typed properties as a null value */
|
||||
ZVAL_NULL(&prop_copy);
|
||||
} else {
|
||||
/* copy: enforce read only access */
|
||||
ZVAL_COPY_OR_DUP(&prop_copy, prop);
|
||||
}
|
||||
prop = &prop_copy;
|
||||
|
||||
/* this is necessary to make it able to work with default array
|
||||
|
||||
@@ -90,6 +90,9 @@ static zend_bool zend_valid_closure_binding(
|
||||
} else {
|
||||
zend_error(E_DEPRECATED, "Unbinding $this of a method is deprecated");
|
||||
}
|
||||
} else if (!is_fake_closure && !Z_ISUNDEF(closure->this_ptr)) {
|
||||
// TODO: Only deprecate if it had $this *originally*?
|
||||
zend_error(E_DEPRECATED, "Unbinding $this of closure is deprecated");
|
||||
}
|
||||
|
||||
if (scope && scope != func->common.scope && scope->type == ZEND_INTERNAL_CLASS) {
|
||||
|
||||
+66
-10
@@ -329,7 +329,7 @@ void zend_init_compiler_data_structures(void) /* {{{ */
|
||||
zend_stack_init(&CG(delayed_oplines_stack), sizeof(zend_op));
|
||||
CG(active_class_entry) = NULL;
|
||||
CG(in_compilation) = 0;
|
||||
CG(start_lineno) = 0;
|
||||
CG(skip_shebang) = 0;
|
||||
|
||||
CG(encoding_declared) = 0;
|
||||
CG(memoized_exprs) = NULL;
|
||||
@@ -1140,11 +1140,24 @@ ZEND_API uint32_t zend_build_delayed_early_binding_list(const zend_op_array *op_
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array, uint32_t first_early_binding_opline) /* {{{ */
|
||||
ZEND_API void zend_do_delayed_early_binding(zend_op_array *op_array, uint32_t first_early_binding_opline) /* {{{ */
|
||||
{
|
||||
if (first_early_binding_opline != (uint32_t)-1) {
|
||||
zend_bool orig_in_compilation = CG(in_compilation);
|
||||
uint32_t opline_num = first_early_binding_opline;
|
||||
void **run_time_cache;
|
||||
|
||||
if (!ZEND_MAP_PTR(op_array->run_time_cache)) {
|
||||
void *ptr;
|
||||
|
||||
ZEND_ASSERT(op_array->fn_flags & ZEND_ACC_HEAP_RT_CACHE);
|
||||
ptr = emalloc(op_array->cache_size + sizeof(void*));
|
||||
ZEND_MAP_PTR_INIT(op_array->run_time_cache, ptr);
|
||||
ptr = (char*)ptr + sizeof(void*);
|
||||
ZEND_MAP_PTR_SET(op_array->run_time_cache, ptr);
|
||||
memset(ptr, 0, op_array->cache_size);
|
||||
}
|
||||
run_time_cache = RUN_TIME_CACHE(op_array);
|
||||
|
||||
CG(in_compilation) = 1;
|
||||
while (opline_num != (uint32_t)-1) {
|
||||
@@ -1158,7 +1171,10 @@ ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array, uint3
|
||||
zend_class_entry *parent_ce = zend_hash_find_ex_ptr(EG(class_table), lc_parent_name, 1);
|
||||
|
||||
if (parent_ce) {
|
||||
zend_try_early_bind(ce, parent_ce, Z_STR_P(lcname), zv);
|
||||
if (zend_try_early_bind(ce, parent_ce, Z_STR_P(lcname), zv)) {
|
||||
/* Store in run-time cache */
|
||||
((void**)((char*)run_time_cache + opline->extended_value))[0] = ce;
|
||||
}
|
||||
}
|
||||
}
|
||||
opline_num = op_array->opcodes[opline_num].result.opline_num;
|
||||
@@ -1394,6 +1410,36 @@ static zend_bool zend_try_compile_const_expr_resolve_class_name(zval *zv, zend_a
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* We don't use zend_verify_const_access because we need to deal with unlinked classes. */
|
||||
static zend_bool zend_verify_ct_const_access(zend_class_constant *c, zend_class_entry *scope)
|
||||
{
|
||||
if (Z_ACCESS_FLAGS(c->value) & ZEND_ACC_PUBLIC) {
|
||||
return 1;
|
||||
} else if (Z_ACCESS_FLAGS(c->value) & ZEND_ACC_PRIVATE) {
|
||||
return c->ce == scope;
|
||||
} else {
|
||||
zend_class_entry *ce = c->ce;
|
||||
while (1) {
|
||||
if (ce == scope) {
|
||||
return 1;
|
||||
}
|
||||
if (!ce->parent) {
|
||||
break;
|
||||
}
|
||||
if (ce->ce_flags & ZEND_ACC_RESOLVED_PARENT) {
|
||||
ce = ce->parent;
|
||||
} else {
|
||||
ce = zend_hash_find_ptr_lc(CG(class_table), ZSTR_VAL(ce->parent_name), ZSTR_LEN(ce->parent_name));
|
||||
if (!ce) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Reverse case cannot be true during compilation */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static zend_bool zend_try_ct_eval_class_const(zval *zv, zend_string *class_name, zend_string *name) /* {{{ */
|
||||
{
|
||||
uint32_t fetch_type = zend_get_class_fetch_type(class_name);
|
||||
@@ -1417,7 +1463,7 @@ static zend_bool zend_try_ct_eval_class_const(zval *zv, zend_string *class_name,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!cc || !zend_verify_const_access(cc, CG(active_class_entry))) {
|
||||
if (!cc || !zend_verify_ct_const_access(cc, CG(active_class_entry))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2371,6 +2417,10 @@ static inline void zend_emit_assign_znode(zend_ast *var_ast, znode *value_node)
|
||||
|
||||
static zend_op *zend_delayed_compile_dim(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
|
||||
{
|
||||
if (ast->attr == ZEND_DIM_ALTERNATIVE_SYNTAX) {
|
||||
zend_error(E_DEPRECATED, "Array and string offset access syntax with curly braces is deprecated");
|
||||
}
|
||||
|
||||
zend_ast *var_ast = ast->child[0];
|
||||
zend_ast *dim_ast = ast->child[1];
|
||||
zend_op *opline;
|
||||
@@ -3688,7 +3738,6 @@ int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_l
|
||||
return zend_compile_func_typecheck(result, args, IS_LONG);
|
||||
} else if (zend_string_equals_literal(lcname, "is_float")
|
||||
|| zend_string_equals_literal(lcname, "is_double")
|
||||
|| zend_string_equals_literal(lcname, "is_real")
|
||||
) {
|
||||
return zend_compile_func_typecheck(result, args, IS_DOUBLE);
|
||||
} else if (zend_string_equals_literal(lcname, "is_string")) {
|
||||
@@ -3960,11 +4009,10 @@ void zend_compile_new(znode *result, zend_ast *ast) /* {{{ */
|
||||
zend_op *opline;
|
||||
|
||||
if (class_ast->kind == ZEND_AST_CLASS) {
|
||||
/* jump over anon class declaration */
|
||||
/* anon class declaration */
|
||||
opline = zend_compile_class_decl(class_ast, 0);
|
||||
class_node.op_type = opline->result_type;
|
||||
class_node.u.op.var = opline->result.var;
|
||||
opline->extended_value = get_next_op_number();
|
||||
} else {
|
||||
zend_compile_class_ref(&class_node, class_ast, ZEND_FETCH_CLASS_EXCEPTION);
|
||||
}
|
||||
@@ -5852,6 +5900,7 @@ static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_as
|
||||
|
||||
if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
|
||||
opline = zend_emit_op_tmp(result, ZEND_DECLARE_LAMBDA_FUNCTION, NULL, NULL);
|
||||
opline->extended_value = zend_alloc_cache_slot();
|
||||
opline->op1_type = IS_CONST;
|
||||
LITERAL_STR(opline->op1, key);
|
||||
} else {
|
||||
@@ -6471,6 +6520,7 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
|
||||
|
||||
if (decl->flags & ZEND_ACC_ANON_CLASS) {
|
||||
opline->opcode = ZEND_DECLARE_ANON_CLASS;
|
||||
opline->extended_value = zend_alloc_cache_slot();
|
||||
opline->result_type = IS_VAR;
|
||||
opline->result.var = get_temporary_variable();
|
||||
|
||||
@@ -6496,6 +6546,7 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
|
||||
) {
|
||||
CG(active_op_array)->fn_flags |= ZEND_ACC_EARLY_BINDING;
|
||||
opline->opcode = ZEND_DECLARE_CLASS_DELAYED;
|
||||
opline->extended_value = zend_alloc_cache_slot();
|
||||
opline->result_type = IS_UNUSED;
|
||||
opline->result.opline_num = -1;
|
||||
}
|
||||
@@ -8744,7 +8795,7 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
|
||||
case ZEND_AST_COALESCE:
|
||||
/* Set isset fetch indicator here, opcache disallows runtime altering of the AST */
|
||||
if (ast->child[0]->kind == ZEND_AST_DIM) {
|
||||
ast->child[0]->attr = ZEND_DIM_IS;
|
||||
ast->child[0]->attr |= ZEND_DIM_IS;
|
||||
}
|
||||
zend_eval_const_expr(&ast->child[0]);
|
||||
|
||||
@@ -8798,9 +8849,14 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
|
||||
if (ast->attr & ZEND_DIM_ALTERNATIVE_SYNTAX) {
|
||||
ast->attr &= ~ZEND_DIM_ALTERNATIVE_SYNTAX; /* remove flag to avoid duplicate warning */
|
||||
zend_error(E_DEPRECATED, "Array and string offset access syntax with curly braces is deprecated");
|
||||
}
|
||||
|
||||
/* Set isset fetch indicator here, opcache disallows runtime altering of the AST */
|
||||
if (ast->attr == ZEND_DIM_IS && ast->child[0]->kind == ZEND_AST_DIM) {
|
||||
ast->child[0]->attr = ZEND_DIM_IS;
|
||||
if (ast->attr & ZEND_DIM_IS && ast->child[0]->kind == ZEND_AST_DIM) {
|
||||
ast->child[0]->attr |= ZEND_DIM_IS;
|
||||
}
|
||||
|
||||
zend_eval_const_expr(&ast->child[0]);
|
||||
|
||||
+3
-2
@@ -753,7 +753,7 @@ void zend_do_free(znode *op1);
|
||||
ZEND_API int do_bind_function(zval *lcname);
|
||||
ZEND_API int do_bind_class(zval *lcname, zend_string *lc_parent_name);
|
||||
ZEND_API uint32_t zend_build_delayed_early_binding_list(const zend_op_array *op_array);
|
||||
ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array, uint32_t first_early_binding_opline);
|
||||
ZEND_API void zend_do_delayed_early_binding(zend_op_array *op_array, uint32_t first_early_binding_opline);
|
||||
|
||||
void zend_do_extended_info(void);
|
||||
void zend_do_extended_fcall_begin(void);
|
||||
@@ -924,7 +924,8 @@ void zend_assert_valid_class_name(const zend_string *const_name);
|
||||
#define ZEND_SEND_BY_REF 1u
|
||||
#define ZEND_SEND_PREFER_REF 2u
|
||||
|
||||
#define ZEND_DIM_IS 1
|
||||
#define ZEND_DIM_IS (1 << 0) /* isset fetch needed for null coalesce */
|
||||
#define ZEND_DIM_ALTERNATIVE_SYNTAX (1 << 1) /* deprecated curly brace usage */
|
||||
|
||||
#define IS_CONSTANT_UNQUALIFIED 0x010
|
||||
#define IS_CONSTANT_CLASS 0x080 /* __CLASS__ in trait */
|
||||
|
||||
+64
-20
@@ -364,16 +364,6 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_R(uint32_t var EXE
|
||||
return ret;
|
||||
}
|
||||
|
||||
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_UNSET(uint32_t var EXECUTE_DATA_DC)
|
||||
{
|
||||
zval *ret = EX_VAR(var);
|
||||
|
||||
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
|
||||
return zval_undefined_cv(var EXECUTE_DATA_CC);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_IS(uint32_t var EXECUTE_DATA_DC)
|
||||
{
|
||||
zval *ret = EX_VAR(var);
|
||||
@@ -445,7 +435,7 @@ static zend_always_inline zval *_get_op_data_zval_ptr_r(int op_type, znode_op no
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline zval *_get_zval_ptr_deref(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
|
||||
static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_zval_ptr_deref(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
|
||||
{
|
||||
if (op_type & (IS_TMP_VAR|IS_VAR)) {
|
||||
if (op_type == IS_TMP_VAR) {
|
||||
@@ -1323,11 +1313,14 @@ static zend_always_inline int zend_binary_op(zval *ret, zval *op1, zval *op2 OPL
|
||||
return zend_binary_ops[opcode - ZEND_ADD](ret, op1, op2);
|
||||
}
|
||||
|
||||
static zend_never_inline void zend_binary_assign_op_obj_dim(zval *object, zval *property, zval *value OPLINE_DC EXECUTE_DATA_DC)
|
||||
static zend_never_inline void zend_binary_assign_op_obj_dim(zval *object, zval *property OPLINE_DC EXECUTE_DATA_DC)
|
||||
{
|
||||
zend_free_op free_op_data1;
|
||||
zval *value;
|
||||
zval *z;
|
||||
zval rv, res;
|
||||
|
||||
value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
|
||||
if ((z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R, &rv)) != NULL) {
|
||||
|
||||
if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) {
|
||||
@@ -1355,6 +1348,7 @@ static zend_never_inline void zend_binary_assign_op_obj_dim(zval *object, zval *
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
}
|
||||
}
|
||||
FREE_OP(free_op_data1);
|
||||
}
|
||||
|
||||
static zend_never_inline void zend_binary_assign_op_typed_ref(zend_reference *ref, zval *value OPLINE_DC EXECUTE_DATA_DC)
|
||||
@@ -2015,6 +2009,24 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_new_element_for_s
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
}
|
||||
|
||||
static ZEND_COLD void zend_binary_assign_op_dim_slow(zval *container, zval *dim OPLINE_DC EXECUTE_DATA_DC)
|
||||
{
|
||||
zend_free_op free_op_data1;
|
||||
|
||||
if (UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
|
||||
if (opline->op2_type == IS_UNUSED) {
|
||||
zend_use_new_element_for_string();
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
} else if (EXPECTED(!Z_ISERROR_P(container))) {
|
||||
zend_use_scalar_as_array();
|
||||
}
|
||||
get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
|
||||
FREE_OP(free_op_data1);
|
||||
}
|
||||
|
||||
static zend_never_inline zend_uchar slow_index_convert(const zval *dim, zend_value *value EXECUTE_DATA_DC)
|
||||
{
|
||||
switch (Z_TYPE_P(dim)) {
|
||||
@@ -2295,7 +2307,7 @@ static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_UNSET(z
|
||||
zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_UNSET EXECUTE_DATA_CC);
|
||||
}
|
||||
|
||||
static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type, int support_strings, int slow EXECUTE_DATA_DC)
|
||||
static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type, int is_list, int slow EXECUTE_DATA_DC)
|
||||
{
|
||||
zval *retval;
|
||||
|
||||
@@ -2312,7 +2324,7 @@ try_array:
|
||||
}
|
||||
}
|
||||
}
|
||||
if (support_strings && EXPECTED(Z_TYPE_P(container) == IS_STRING)) {
|
||||
if (!is_list && EXPECTED(Z_TYPE_P(container) == IS_STRING)) {
|
||||
zend_long offset;
|
||||
|
||||
try_string_offset:
|
||||
@@ -2390,11 +2402,15 @@ try_string_offset:
|
||||
}
|
||||
} else {
|
||||
if (type != BP_VAR_IS && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
|
||||
ZVAL_UNDEFINED_OP1();
|
||||
container = ZVAL_UNDEFINED_OP1();
|
||||
}
|
||||
if (/*dim_type == IS_CV &&*/ UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
|
||||
ZVAL_UNDEFINED_OP2();
|
||||
}
|
||||
if (!is_list && type != BP_VAR_IS) {
|
||||
zend_error(E_NOTICE, "Trying to access array offset on value of type %s",
|
||||
zend_zval_type_name(container));
|
||||
}
|
||||
ZVAL_NULL(result);
|
||||
}
|
||||
}
|
||||
@@ -2402,30 +2418,30 @@ try_string_offset:
|
||||
static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_read_R(zval *container, zval *dim, int dim_type OPLINE_DC EXECUTE_DATA_DC)
|
||||
{
|
||||
zval *result = EX_VAR(opline->result.var);
|
||||
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 1, 0 EXECUTE_DATA_CC);
|
||||
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 0, 0 EXECUTE_DATA_CC);
|
||||
}
|
||||
|
||||
static zend_never_inline void zend_fetch_dimension_address_read_R_slow(zval *container, zval *dim OPLINE_DC EXECUTE_DATA_DC)
|
||||
{
|
||||
zval *result = EX_VAR(opline->result.var);
|
||||
zend_fetch_dimension_address_read(result, container, dim, IS_CV, BP_VAR_R, 1, 1 EXECUTE_DATA_CC);
|
||||
zend_fetch_dimension_address_read(result, container, dim, IS_CV, BP_VAR_R, 0, 1 EXECUTE_DATA_CC);
|
||||
}
|
||||
|
||||
static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_read_IS(zval *container, zval *dim, int dim_type OPLINE_DC EXECUTE_DATA_DC)
|
||||
{
|
||||
zval *result = EX_VAR(opline->result.var);
|
||||
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_IS, 1, 0 EXECUTE_DATA_CC);
|
||||
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_IS, 0, 0 EXECUTE_DATA_CC);
|
||||
}
|
||||
|
||||
static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_LIST_r(zval *container, zval *dim, int dim_type OPLINE_DC EXECUTE_DATA_DC)
|
||||
{
|
||||
zval *result = EX_VAR(opline->result.var);
|
||||
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 0, 0 EXECUTE_DATA_CC);
|
||||
zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 1, 0 EXECUTE_DATA_CC);
|
||||
}
|
||||
|
||||
ZEND_API void zend_fetch_dimension_const(zval *result, zval *container, zval *dim, int type)
|
||||
{
|
||||
zend_fetch_dimension_address_read(result, container, dim, IS_TMP_VAR, type, 1, 0 NO_EXECUTE_DATA_CC);
|
||||
zend_fetch_dimension_address_read(result, container, dim, IS_TMP_VAR, type, 0, 0 NO_EXECUTE_DATA_CC);
|
||||
}
|
||||
|
||||
static zend_never_inline zval* ZEND_FASTCALL zend_find_array_dim_slow(HashTable *ht, zval *offset EXECUTE_DATA_DC)
|
||||
@@ -2570,6 +2586,10 @@ num_key:
|
||||
static zend_never_inline uint32_t ZEND_FASTCALL zend_array_key_exists_slow(zval *subject, zval *key OPLINE_DC EXECUTE_DATA_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(subject) == IS_OBJECT)) {
|
||||
zend_error(E_DEPRECATED, "array_key_exists(): "
|
||||
"Using array_key_exists() on objects is deprecated. "
|
||||
"Use isset() or property_exists() instead");
|
||||
|
||||
HashTable *ht = zend_get_properties_for(subject, ZEND_PROP_PURPOSE_ARRAY_CAST);
|
||||
uint32_t result = zend_array_key_exists_fast(ht, key OPLINE_CC EXECUTE_DATA_CC);
|
||||
zend_release_properties(ht);
|
||||
@@ -2735,6 +2755,12 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
|
||||
break;
|
||||
}
|
||||
|
||||
if (container_op_type == IS_CV
|
||||
&& type != BP_VAR_W
|
||||
&& UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
|
||||
container = ZVAL_UNDEFINED_OP1();
|
||||
}
|
||||
|
||||
/* this should modify object only if it's empty */
|
||||
if (type == BP_VAR_UNSET) {
|
||||
return;
|
||||
@@ -3895,6 +3921,7 @@ ZEND_API void zend_cleanup_unfinished_execution(zend_execute_data *execute_data,
|
||||
cleanup_live_vars(execute_data, op_num, catch_op_num);
|
||||
}
|
||||
|
||||
#if ZEND_VM_SPEC
|
||||
static void zend_swap_operands(zend_op *op) /* {{{ */
|
||||
{
|
||||
znode_op tmp;
|
||||
@@ -3908,6 +3935,7 @@ static void zend_swap_operands(zend_op *op) /* {{{ */
|
||||
op->op2_type = tmp_type;
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_string *function, uint32_t num_args) /* {{{ */
|
||||
{
|
||||
@@ -4514,6 +4542,14 @@ static zend_never_inline int ZEND_FASTCALL zend_quick_check_constant(
|
||||
ZEND_VM_CONTINUE(); \
|
||||
} \
|
||||
} while (0)
|
||||
#define ZEND_VM_SMART_BRANCH_TRUE_JMPZ() do { \
|
||||
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
|
||||
ZEND_VM_CONTINUE(); \
|
||||
} while (0)
|
||||
#define ZEND_VM_SMART_BRANCH_TRUE_JMPNZ() do { \
|
||||
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
|
||||
ZEND_VM_CONTINUE(); \
|
||||
} while (0)
|
||||
#define ZEND_VM_SMART_BRANCH_FALSE() do { \
|
||||
if (EXPECTED((opline+1)->opcode == ZEND_JMPNZ)) { \
|
||||
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
|
||||
@@ -4523,6 +4559,14 @@ static zend_never_inline int ZEND_FASTCALL zend_quick_check_constant(
|
||||
ZEND_VM_CONTINUE(); \
|
||||
} \
|
||||
} while (0)
|
||||
#define ZEND_VM_SMART_BRANCH_FALSE_JMPZ() do { \
|
||||
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
|
||||
ZEND_VM_CONTINUE(); \
|
||||
} while (0)
|
||||
#define ZEND_VM_SMART_BRANCH_FALSE_JMPNZ() do { \
|
||||
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
|
||||
ZEND_VM_CONTINUE(); \
|
||||
} while (0)
|
||||
#else
|
||||
# define ZEND_VM_REPEATABLE_OPCODE
|
||||
# define ZEND_VM_REPEAT_OPCODE(_opcode)
|
||||
|
||||
+5
-2
@@ -150,7 +150,7 @@
|
||||
#define GC_DEFAULT_BUF_SIZE (16 * 1024)
|
||||
#define GC_BUF_GROW_STEP (128 * 1024)
|
||||
|
||||
#define GC_MAX_UNCOMPRESSED (1024 * 1024)
|
||||
#define GC_MAX_UNCOMPRESSED (512 * 1024)
|
||||
#define GC_MAX_BUF_SIZE 0x40000000
|
||||
|
||||
#define GC_THRESHOLD_DEFAULT 10000
|
||||
@@ -316,7 +316,10 @@ static void gc_stack_free(gc_stack *stack)
|
||||
|
||||
static zend_always_inline uint32_t gc_compress(uint32_t idx)
|
||||
{
|
||||
return idx % GC_MAX_UNCOMPRESSED;
|
||||
if (EXPECTED(idx < GC_MAX_UNCOMPRESSED)) {
|
||||
return idx;
|
||||
}
|
||||
return (idx % GC_MAX_UNCOMPRESSED) | GC_MAX_UNCOMPRESSED;
|
||||
}
|
||||
|
||||
static zend_always_inline gc_root_buffer* gc_decompress(zend_refcounted *ref, uint32_t idx)
|
||||
|
||||
+2
-2
@@ -71,10 +71,10 @@ END_EXTERN_C()
|
||||
|
||||
static zend_always_inline void gc_check_possible_root(zend_refcounted *ref)
|
||||
{
|
||||
if (GC_TYPE_INFO(ref) == IS_REFERENCE) {
|
||||
if (EXPECTED(GC_TYPE_INFO(ref) == IS_REFERENCE)) {
|
||||
zval *zv = &((zend_reference*)ref)->val;
|
||||
|
||||
if (!Z_REFCOUNTED_P(zv)) {
|
||||
if (!Z_COLLECTABLE_P(zv)) {
|
||||
return;
|
||||
}
|
||||
ref = Z_COUNTED_P(zv);
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ struct _zend_compiler_globals {
|
||||
|
||||
struct _zend_ini_parser_param *ini_parser_param;
|
||||
|
||||
uint32_t start_lineno;
|
||||
zend_bool skip_shebang;
|
||||
zend_bool increment_lineno;
|
||||
|
||||
zend_string *doc_comment;
|
||||
|
||||
@@ -221,6 +221,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
|
||||
%token T_COALESCE "?? (T_COALESCE)"
|
||||
%token T_POW "** (T_POW)"
|
||||
%token T_POW_EQUAL "**= (T_POW_EQUAL)"
|
||||
%token T_BAD_CHARACTER "invalid character (T_BAD_CHARACTER)"
|
||||
|
||||
/* Token used to force a parse error from the lexer */
|
||||
%token T_ERROR
|
||||
@@ -1154,7 +1155,7 @@ callable_variable:
|
||||
| constant '[' optional_expr ']'
|
||||
{ $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
|
||||
| dereferencable '{' expr '}'
|
||||
{ $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
|
||||
{ $$ = zend_ast_create_ex(ZEND_AST_DIM, ZEND_DIM_ALTERNATIVE_SYNTAX, $1, $3); }
|
||||
| dereferencable T_OBJECT_OPERATOR property_name argument_list
|
||||
{ $$ = zend_ast_create(ZEND_AST_METHOD_CALL, $1, $3, $4); }
|
||||
| function_call { $$ = $1; }
|
||||
@@ -1339,7 +1340,7 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
|
||||
|
||||
if (LANG_SCNG(yy_text)[0] == 0 &&
|
||||
LANG_SCNG(yy_leng) == 1 &&
|
||||
memcmp(yystr, "\"end of file\"", sizeof("\"end of file\"") - 1) == 0) {
|
||||
strcmp(yystr, "\"end of file\"") == 0) {
|
||||
if (yyres) {
|
||||
yystpcpy(yyres, "end of file");
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include "zend_strtod.h"
|
||||
#include "zend_exceptions.h"
|
||||
#include "zend_virtual_cwd.h"
|
||||
#include "tsrm_config_common.h"
|
||||
|
||||
#define YYCTYPE unsigned char
|
||||
#define YYFILL(n) { if ((YYCURSOR + n) >= (YYLIMIT + ZEND_MMAP_AHEAD)) { return 0; } }
|
||||
@@ -514,16 +513,9 @@ ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding)
|
||||
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle)
|
||||
{
|
||||
char *buf;
|
||||
size_t size, offset = 0;
|
||||
size_t size;
|
||||
zend_string *compiled_filename;
|
||||
|
||||
/* The shebang line was read, get the current position to obtain the buffer start */
|
||||
if (CG(start_lineno) == 2 && file_handle->type == ZEND_HANDLE_FP && file_handle->handle.fp) {
|
||||
if ((offset = ftell(file_handle->handle.fp)) == (size_t)-1) {
|
||||
offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (zend_stream_fixup(file_handle, &buf, &size) == FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -557,13 +549,18 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle)
|
||||
size = SCNG(script_filtered_size);
|
||||
}
|
||||
}
|
||||
SCNG(yy_start) = (unsigned char *)buf - offset;
|
||||
SCNG(yy_start) = (unsigned char *)buf;
|
||||
yy_scan_buffer(buf, (unsigned int)size);
|
||||
} else {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "zend_stream_mmap() failed");
|
||||
}
|
||||
|
||||
BEGIN(INITIAL);
|
||||
if (CG(skip_shebang)) {
|
||||
CG(skip_shebang) = 0;
|
||||
BEGIN(SHEBANG);
|
||||
} else {
|
||||
BEGIN(INITIAL);
|
||||
}
|
||||
|
||||
if (file_handle->opened_path) {
|
||||
compiled_filename = zend_string_copy(file_handle->opened_path);
|
||||
@@ -574,14 +571,8 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle)
|
||||
zend_set_compiled_filename(compiled_filename);
|
||||
zend_string_release_ex(compiled_filename, 0);
|
||||
|
||||
if (CG(start_lineno)) {
|
||||
CG(zend_lineno) = CG(start_lineno);
|
||||
CG(start_lineno) = 0;
|
||||
} else {
|
||||
CG(zend_lineno) = 1;
|
||||
}
|
||||
|
||||
RESET_DOC_COMMENT();
|
||||
CG(zend_lineno) = 1;
|
||||
CG(increment_lineno) = 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -668,11 +659,7 @@ zend_op_array *compile_filename(int type, zval *filename)
|
||||
ZVAL_STR(&tmp, zval_get_string(filename));
|
||||
filename = &tmp;
|
||||
}
|
||||
file_handle.filename = Z_STRVAL_P(filename);
|
||||
file_handle.free_filename = 0;
|
||||
file_handle.type = ZEND_HANDLE_FILENAME;
|
||||
file_handle.opened_path = NULL;
|
||||
file_handle.handle.fp = NULL;
|
||||
zend_stream_init_filename(&file_handle, Z_STRVAL_P(filename));
|
||||
|
||||
retval = zend_compile_file(&file_handle, type);
|
||||
if (retval && file_handle.handle.stream.handle) {
|
||||
@@ -798,10 +785,7 @@ int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlight
|
||||
zend_lex_state original_lex_state;
|
||||
zend_file_handle file_handle;
|
||||
|
||||
file_handle.type = ZEND_HANDLE_FILENAME;
|
||||
file_handle.filename = filename;
|
||||
file_handle.free_filename = 0;
|
||||
file_handle.opened_path = NULL;
|
||||
zend_stream_init_filename(&file_handle, filename);
|
||||
zend_save_lexical_state(&original_lex_state);
|
||||
if (open_file_for_scanning(&file_handle)==FAILURE) {
|
||||
zend_message_dispatcher(ZMSG_FAILED_HIGHLIGHT_FOPEN, filename);
|
||||
@@ -1243,9 +1227,12 @@ static void copy_heredoc_label_stack(void *void_heredoc_label)
|
||||
goto emit_token_with_str; \
|
||||
} while (0)
|
||||
|
||||
#define SKIP_TOKEN(_token) do { \
|
||||
#define RETURN_OR_SKIP_TOKEN(_token) do { \
|
||||
token = _token; \
|
||||
goto skip_token; \
|
||||
if (PARSER_MODE()) { \
|
||||
goto skip_token; \
|
||||
} \
|
||||
goto emit_token; \
|
||||
} while (0)
|
||||
|
||||
int ZEND_FASTCALL lex_scan(zval *zendlval, zend_parser_stack_elem *elem)
|
||||
@@ -1497,7 +1484,14 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
RETURN_TOKEN(T_INT_CAST);
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("real"|"double"|"float"){TABS_AND_SPACES}")" {
|
||||
<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("double"|"float"){TABS_AND_SPACES}")" {
|
||||
RETURN_TOKEN(T_DOUBLE_CAST);
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"real"{TABS_AND_SPACES}")" {
|
||||
if (PARSER_MODE()) {
|
||||
zend_error(E_DEPRECATED, "The (real) cast is deprecated, use (float) instead");
|
||||
}
|
||||
RETURN_TOKEN(T_DOUBLE_CAST);
|
||||
}
|
||||
|
||||
@@ -2010,6 +2004,17 @@ string:
|
||||
RETURN_TOKEN(T_NS_C);
|
||||
}
|
||||
|
||||
<SHEBANG>"#!" .* {NEWLINE} {
|
||||
CG(zend_lineno)++;
|
||||
BEGIN(INITIAL);
|
||||
goto restart;
|
||||
}
|
||||
|
||||
<SHEBANG>{ANY_CHAR} {
|
||||
yyless(0);
|
||||
BEGIN(INITIAL);
|
||||
goto restart;
|
||||
}
|
||||
|
||||
<INITIAL>"<?=" {
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
@@ -2023,20 +2028,28 @@ string:
|
||||
<INITIAL>"<?php"([ \t]|{NEWLINE}) {
|
||||
HANDLE_NEWLINE(yytext[yyleng-1]);
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
if (PARSER_MODE()) {
|
||||
SKIP_TOKEN(T_OPEN_TAG);
|
||||
}
|
||||
RETURN_TOKEN(T_OPEN_TAG);
|
||||
RETURN_OR_SKIP_TOKEN(T_OPEN_TAG);
|
||||
}
|
||||
|
||||
<INITIAL>"<?php" {
|
||||
/* Allow <?php followed by end of file. */
|
||||
if (YYCURSOR == YYLIMIT) {
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
RETURN_OR_SKIP_TOKEN(T_OPEN_TAG);
|
||||
}
|
||||
/* Degenerate case: <?phpX is interpreted as <? phpX with short tags. */
|
||||
if (CG(short_tags)) {
|
||||
yyless(2);
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
RETURN_OR_SKIP_TOKEN(T_OPEN_TAG);
|
||||
}
|
||||
goto inline_char_handler;
|
||||
}
|
||||
|
||||
<INITIAL>"<?" {
|
||||
if (CG(short_tags)) {
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
if (PARSER_MODE()) {
|
||||
SKIP_TOKEN(T_OPEN_TAG);
|
||||
}
|
||||
RETURN_TOKEN(T_OPEN_TAG);
|
||||
RETURN_OR_SKIP_TOKEN(T_OPEN_TAG);
|
||||
} else {
|
||||
goto inline_char_handler;
|
||||
}
|
||||
@@ -2059,8 +2072,12 @@ inline_char_handler:
|
||||
}
|
||||
|
||||
if (*YYCURSOR == '?') {
|
||||
if (CG(short_tags) || !strncasecmp((char*)YYCURSOR + 1, "php", 3) || (*(YYCURSOR + 1) == '=')) { /* Assume [ \t\n\r] follows "php" */
|
||||
|
||||
if (CG(short_tags) /* <? */
|
||||
|| (*(YYCURSOR + 1) == '=') /* <?= */
|
||||
|| (!strncasecmp((char*)YYCURSOR + 1, "php", 3) && /* <?php[ \t\r\n] */
|
||||
(YYCURSOR[4] == ' ' || YYCURSOR[4] == '\t' ||
|
||||
YYCURSOR[4] == '\n' || YYCURSOR[4] == '\r'))
|
||||
) {
|
||||
YYCURSOR--;
|
||||
break;
|
||||
}
|
||||
@@ -2159,11 +2176,7 @@ inline_char_handler:
|
||||
}
|
||||
|
||||
yyleng = YYCURSOR - SCNG(yy_text);
|
||||
|
||||
if (PARSER_MODE()) {
|
||||
SKIP_TOKEN(T_COMMENT);
|
||||
}
|
||||
RETURN_TOKEN(T_COMMENT);
|
||||
RETURN_OR_SKIP_TOKEN(T_COMMENT);
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"/*"|"/**"{WHITESPACE} {
|
||||
@@ -2193,16 +2206,10 @@ inline_char_handler:
|
||||
|
||||
if (doc_com) {
|
||||
CG(doc_comment) = zend_string_init(yytext, yyleng, 0);
|
||||
if (PARSER_MODE()) {
|
||||
SKIP_TOKEN(T_DOC_COMMENT);
|
||||
}
|
||||
RETURN_TOKEN(T_DOC_COMMENT);
|
||||
RETURN_OR_SKIP_TOKEN(T_DOC_COMMENT);
|
||||
}
|
||||
|
||||
if (PARSER_MODE()) {
|
||||
SKIP_TOKEN(T_COMMENT);
|
||||
}
|
||||
RETURN_TOKEN(T_COMMENT);
|
||||
RETURN_OR_SKIP_TOKEN(T_COMMENT);
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"?>"{NEWLINE}? {
|
||||
@@ -2844,8 +2851,12 @@ nowdoc_scan_done:
|
||||
RETURN_TOKEN(END);
|
||||
}
|
||||
|
||||
zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
|
||||
goto restart;
|
||||
zend_error(E_COMPILE_WARNING, "Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
|
||||
if (PARSER_MODE()) {
|
||||
goto restart;
|
||||
} else {
|
||||
RETURN_TOKEN(T_BAD_CHARACTER);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
@@ -959,7 +959,6 @@ ZEND_API int pass_two(zend_op_array *op_array)
|
||||
ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op2);
|
||||
break;
|
||||
}
|
||||
case ZEND_DECLARE_ANON_CLASS:
|
||||
case ZEND_FE_FETCH_R:
|
||||
case ZEND_FE_FETCH_RW:
|
||||
/* absolute index to relative offset */
|
||||
|
||||
+16
-5
@@ -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,21 +342,32 @@ 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) {
|
||||
if (sa.sa_sigaction != zend_signal_handler_defer &&
|
||||
sa.sa_sigaction != (void *) SIG_IGN) {
|
||||
zend_error(E_CORE_WARNING, "zend_signal: handler was replaced for signal (%d) after startup", zend_sigs[x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SIGNAL_BEGIN_CRITICAL();
|
||||
SIGG(active) = 0;
|
||||
/* 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;
|
||||
|
||||
SIGG(running) = 0;
|
||||
SIGG(blocked) = 0;
|
||||
SIGG(depth) = 0;
|
||||
SIGNAL_END_CRITICAL();
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
+74
-169
@@ -23,30 +23,9 @@
|
||||
#include "zend_compile.h"
|
||||
#include "zend_stream.h"
|
||||
|
||||
#if HAVE_MMAP
|
||||
# if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
# if defined(_SC_PAGESIZE)
|
||||
# define REAL_PAGE_SIZE sysconf(_SC_PAGESIZE);
|
||||
# elif defined(_SC_PAGE_SIZE)
|
||||
# define REAL_PAGE_SIZE sysconf(_SC_PAGE_SIZE);
|
||||
# endif
|
||||
# endif
|
||||
# if HAVE_SYS_MMAN_H
|
||||
# include <sys/mman.h>
|
||||
# endif
|
||||
# ifndef REAL_PAGE_SIZE
|
||||
# ifdef PAGE_SIZE
|
||||
# define REAL_PAGE_SIZE PAGE_SIZE
|
||||
# else
|
||||
# define REAL_PAGE_SIZE 4096
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
ZEND_DLIMPORT int isatty(int fd);
|
||||
|
||||
static size_t zend_stream_stdio_reader(void *handle, char *buf, size_t len) /* {{{ */
|
||||
static ssize_t zend_stream_stdio_reader(void *handle, char *buf, size_t len) /* {{{ */
|
||||
{
|
||||
return fread(buf, 1, len, (FILE*)handle);
|
||||
} /* }}} */
|
||||
@@ -69,72 +48,41 @@ static size_t zend_stream_stdio_fsizer(void *handle) /* {{{ */
|
||||
#endif
|
||||
return buf.st_size;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
static void zend_stream_unmap(zend_stream *stream) { /* {{{ */
|
||||
#if HAVE_MMAP
|
||||
if (stream->mmap.map) {
|
||||
munmap(stream->mmap.map, stream->mmap.len + ZEND_MMAP_AHEAD);
|
||||
} else
|
||||
#endif
|
||||
if (stream->mmap.buf) {
|
||||
efree(stream->mmap.buf);
|
||||
}
|
||||
stream->mmap.len = 0;
|
||||
stream->mmap.pos = 0;
|
||||
stream->mmap.map = 0;
|
||||
stream->mmap.buf = 0;
|
||||
stream->handle = stream->mmap.old_handle;
|
||||
} /* }}} */
|
||||
|
||||
static void zend_stream_mmap_closer(zend_stream *stream) /* {{{ */
|
||||
{
|
||||
zend_stream_unmap(stream);
|
||||
if (stream->mmap.old_closer && stream->handle) {
|
||||
stream->mmap.old_closer(stream->handle);
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
static inline int zend_stream_is_mmap(zend_file_handle *file_handle) { /* {{{ */
|
||||
return file_handle->type == ZEND_HANDLE_MAPPED;
|
||||
return -1;
|
||||
} /* }}} */
|
||||
|
||||
static size_t zend_stream_fsize(zend_file_handle *file_handle) /* {{{ */
|
||||
{
|
||||
zend_stat_t buf;
|
||||
|
||||
if (zend_stream_is_mmap(file_handle)) {
|
||||
return file_handle->handle.stream.mmap.len;
|
||||
ZEND_ASSERT(file_handle->type == ZEND_HANDLE_STREAM);
|
||||
if (file_handle->handle.stream.isatty) {
|
||||
return 0;
|
||||
}
|
||||
if (file_handle->type == ZEND_HANDLE_STREAM || file_handle->type == ZEND_HANDLE_MAPPED) {
|
||||
return file_handle->handle.stream.fsizer(file_handle->handle.stream.handle);
|
||||
}
|
||||
if (file_handle->handle.fp && zend_fstat(fileno(file_handle->handle.fp), &buf) == 0) {
|
||||
#ifdef S_ISREG
|
||||
if (!S_ISREG(buf.st_mode)) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return buf.st_size;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return file_handle->handle.stream.fsizer(file_handle->handle.stream.handle);
|
||||
} /* }}} */
|
||||
|
||||
ZEND_API void zend_stream_init_fp(zend_file_handle *handle, FILE *fp, const char *filename) {
|
||||
memset(handle, 0, sizeof(zend_file_handle));
|
||||
handle->type = ZEND_HANDLE_FP;
|
||||
handle->handle.fp = fp;
|
||||
handle->filename = filename;
|
||||
}
|
||||
|
||||
ZEND_API void zend_stream_init_filename(zend_file_handle *handle, const char *filename) {
|
||||
memset(handle, 0, sizeof(zend_file_handle));
|
||||
handle->type = ZEND_HANDLE_FILENAME;
|
||||
handle->filename = filename;
|
||||
}
|
||||
|
||||
ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle) /* {{{ */
|
||||
{
|
||||
zend_string *opened_path;
|
||||
if (zend_stream_open_function) {
|
||||
return zend_stream_open_function(filename, handle);
|
||||
}
|
||||
handle->type = ZEND_HANDLE_FP;
|
||||
handle->opened_path = NULL;
|
||||
handle->handle.fp = zend_fopen(filename, &handle->opened_path);
|
||||
handle->filename = filename;
|
||||
handle->free_filename = 0;
|
||||
memset(&handle->handle.stream.mmap, 0, sizeof(zend_mmap));
|
||||
|
||||
return (handle->handle.fp) ? SUCCESS : FAILURE;
|
||||
zend_stream_init_fp(handle, zend_fopen(filename, &opened_path), filename);
|
||||
handle->opened_path = opened_path;
|
||||
return handle->handle.fp ? SUCCESS : FAILURE;
|
||||
} /* }}} */
|
||||
|
||||
static int zend_stream_getc(zend_file_handle *file_handle) /* {{{ */
|
||||
@@ -147,9 +95,9 @@ static int zend_stream_getc(zend_file_handle *file_handle) /* {{{ */
|
||||
return EOF;
|
||||
} /* }}} */
|
||||
|
||||
static size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len) /* {{{ */
|
||||
static ssize_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len) /* {{{ */
|
||||
{
|
||||
if (!zend_stream_is_mmap(file_handle) && file_handle->handle.stream.isatty) {
|
||||
if (file_handle->handle.stream.isatty) {
|
||||
int c = '*';
|
||||
size_t n;
|
||||
|
||||
@@ -167,8 +115,13 @@ static size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t
|
||||
|
||||
ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len) /* {{{ */
|
||||
{
|
||||
size_t size;
|
||||
zend_stream_type old_type;
|
||||
size_t file_size;
|
||||
|
||||
if (file_handle->buf) {
|
||||
*buf = file_handle->buf;
|
||||
*len = file_handle->len;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (file_handle->type == ZEND_HANDLE_FILENAME) {
|
||||
if (zend_stream_open(file_handle->filename, file_handle) == FAILURE) {
|
||||
@@ -176,75 +129,41 @@ ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t
|
||||
}
|
||||
}
|
||||
|
||||
switch (file_handle->type) {
|
||||
case ZEND_HANDLE_FD:
|
||||
file_handle->type = ZEND_HANDLE_FP;
|
||||
file_handle->handle.fp = fdopen(file_handle->handle.fd, "rb");
|
||||
/* no break; */
|
||||
case ZEND_HANDLE_FP:
|
||||
if (!file_handle->handle.fp) {
|
||||
return FAILURE;
|
||||
}
|
||||
memset(&file_handle->handle.stream.mmap, 0, sizeof(zend_mmap));
|
||||
file_handle->handle.stream.isatty = isatty(fileno((FILE *)file_handle->handle.stream.handle));
|
||||
file_handle->handle.stream.reader = (zend_stream_reader_t)zend_stream_stdio_reader;
|
||||
file_handle->handle.stream.closer = (zend_stream_closer_t)zend_stream_stdio_closer;
|
||||
file_handle->handle.stream.fsizer = (zend_stream_fsizer_t)zend_stream_stdio_fsizer;
|
||||
memset(&file_handle->handle.stream.mmap, 0, sizeof(file_handle->handle.stream.mmap));
|
||||
/* no break; */
|
||||
case ZEND_HANDLE_STREAM:
|
||||
/* nothing to do */
|
||||
break;
|
||||
|
||||
case ZEND_HANDLE_MAPPED:
|
||||
file_handle->handle.stream.mmap.pos = 0;
|
||||
*buf = file_handle->handle.stream.mmap.buf;
|
||||
*len = file_handle->handle.stream.mmap.len;
|
||||
return SUCCESS;
|
||||
|
||||
default:
|
||||
if (file_handle->type == ZEND_HANDLE_FP) {
|
||||
if (!file_handle->handle.fp) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
file_handle->type = ZEND_HANDLE_STREAM;
|
||||
file_handle->handle.stream.handle = file_handle->handle.fp;
|
||||
file_handle->handle.stream.isatty = isatty(fileno((FILE *)file_handle->handle.stream.handle));
|
||||
file_handle->handle.stream.reader = (zend_stream_reader_t)zend_stream_stdio_reader;
|
||||
file_handle->handle.stream.closer = (zend_stream_closer_t)zend_stream_stdio_closer;
|
||||
file_handle->handle.stream.fsizer = (zend_stream_fsizer_t)zend_stream_stdio_fsizer;
|
||||
}
|
||||
|
||||
size = zend_stream_fsize(file_handle);
|
||||
if (size == (size_t)-1) {
|
||||
file_size = zend_stream_fsize(file_handle);
|
||||
if (file_size == (size_t)-1) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
old_type = file_handle->type;
|
||||
file_handle->type = ZEND_HANDLE_STREAM; /* we might still be _FP but we need fsize() work */
|
||||
|
||||
if (old_type == ZEND_HANDLE_FP && !file_handle->handle.stream.isatty && size) {
|
||||
#if HAVE_MMAP
|
||||
size_t page_size = REAL_PAGE_SIZE;
|
||||
|
||||
if (file_handle->handle.fp &&
|
||||
size != 0 &&
|
||||
((size - 1) % page_size) <= page_size - ZEND_MMAP_AHEAD) {
|
||||
/* *buf[size] is zeroed automatically by the kernel */
|
||||
*buf = mmap(0, size + ZEND_MMAP_AHEAD, PROT_READ, MAP_PRIVATE, fileno(file_handle->handle.fp), 0);
|
||||
if (*buf != MAP_FAILED) {
|
||||
zend_long offset = ftell(file_handle->handle.fp);
|
||||
file_handle->handle.stream.mmap.map = *buf;
|
||||
|
||||
if (offset != -1) {
|
||||
*buf += offset;
|
||||
size -= offset;
|
||||
}
|
||||
file_handle->handle.stream.mmap.buf = *buf;
|
||||
file_handle->handle.stream.mmap.len = size;
|
||||
|
||||
goto return_mapped;
|
||||
}
|
||||
if (file_size) {
|
||||
ssize_t read;
|
||||
size_t size = 0;
|
||||
*buf = safe_emalloc(1, file_size, ZEND_MMAP_AHEAD);
|
||||
while ((read = zend_stream_read(file_handle, *buf + size, file_size - size)) > 0) {
|
||||
size += read;
|
||||
}
|
||||
#endif
|
||||
file_handle->handle.stream.mmap.map = 0;
|
||||
file_handle->handle.stream.mmap.buf = *buf = safe_emalloc(1, size, ZEND_MMAP_AHEAD);
|
||||
file_handle->handle.stream.mmap.len = zend_stream_read(file_handle, *buf, size);
|
||||
if (read < 0) {
|
||||
efree(*buf);
|
||||
return FAILURE;
|
||||
}
|
||||
file_handle->buf = *buf;
|
||||
file_handle->len = size;
|
||||
} else {
|
||||
size_t read, remain = 4*1024;
|
||||
size_t size = 0, remain = 4*1024;
|
||||
ssize_t read;
|
||||
*buf = emalloc(remain);
|
||||
size = 0;
|
||||
|
||||
while ((read = zend_stream_read(file_handle, *buf + size, remain)) > 0) {
|
||||
size += read;
|
||||
@@ -255,34 +174,27 @@ ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t
|
||||
remain = size;
|
||||
}
|
||||
}
|
||||
file_handle->handle.stream.mmap.map = 0;
|
||||
file_handle->handle.stream.mmap.len = size;
|
||||
if (read < 0) {
|
||||
efree(*buf);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
file_handle->len = size;
|
||||
if (size && remain < ZEND_MMAP_AHEAD) {
|
||||
*buf = safe_erealloc(*buf, size, 1, ZEND_MMAP_AHEAD);
|
||||
}
|
||||
file_handle->handle.stream.mmap.buf = *buf;
|
||||
file_handle->buf = *buf;
|
||||
}
|
||||
|
||||
if (file_handle->handle.stream.mmap.len == 0) {
|
||||
if (file_handle->len == 0) {
|
||||
*buf = erealloc(*buf, ZEND_MMAP_AHEAD);
|
||||
file_handle->handle.stream.mmap.buf = *buf;
|
||||
file_handle->buf = *buf;
|
||||
}
|
||||
|
||||
if (ZEND_MMAP_AHEAD) {
|
||||
memset(file_handle->handle.stream.mmap.buf + file_handle->handle.stream.mmap.len, 0, ZEND_MMAP_AHEAD);
|
||||
}
|
||||
#if HAVE_MMAP
|
||||
return_mapped:
|
||||
#endif
|
||||
file_handle->type = ZEND_HANDLE_MAPPED;
|
||||
file_handle->handle.stream.mmap.pos = 0;
|
||||
file_handle->handle.stream.mmap.old_handle = file_handle->handle.stream.handle;
|
||||
file_handle->handle.stream.mmap.old_closer = file_handle->handle.stream.closer;
|
||||
file_handle->handle.stream.handle = &file_handle->handle.stream;
|
||||
file_handle->handle.stream.closer = (zend_stream_closer_t)zend_stream_mmap_closer;
|
||||
memset(file_handle->buf + file_handle->len, 0, ZEND_MMAP_AHEAD);
|
||||
|
||||
*buf = file_handle->handle.stream.mmap.buf;
|
||||
*len = file_handle->handle.stream.mmap.len;
|
||||
*buf = file_handle->buf;
|
||||
*len = file_handle->len;
|
||||
|
||||
return SUCCESS;
|
||||
} /* }}} */
|
||||
@@ -290,14 +202,10 @@ return_mapped:
|
||||
ZEND_API void zend_file_handle_dtor(zend_file_handle *fh) /* {{{ */
|
||||
{
|
||||
switch (fh->type) {
|
||||
case ZEND_HANDLE_FD:
|
||||
/* nothing to do */
|
||||
break;
|
||||
case ZEND_HANDLE_FP:
|
||||
fclose(fh->handle.fp);
|
||||
break;
|
||||
case ZEND_HANDLE_STREAM:
|
||||
case ZEND_HANDLE_MAPPED:
|
||||
if (fh->handle.stream.closer && fh->handle.stream.handle) {
|
||||
fh->handle.stream.closer(fh->handle.stream.handle);
|
||||
}
|
||||
@@ -313,6 +221,10 @@ ZEND_API void zend_file_handle_dtor(zend_file_handle *fh) /* {{{ */
|
||||
zend_string_release_ex(fh->opened_path, 0);
|
||||
fh->opened_path = NULL;
|
||||
}
|
||||
if (fh->buf) {
|
||||
efree(fh->buf);
|
||||
fh->buf = NULL;
|
||||
}
|
||||
if (fh->free_filename && fh->filename) {
|
||||
efree((char*)fh->filename);
|
||||
fh->filename = NULL;
|
||||
@@ -326,17 +238,10 @@ ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *
|
||||
return 0;
|
||||
}
|
||||
switch (fh1->type) {
|
||||
case ZEND_HANDLE_FD:
|
||||
return fh1->handle.fd == fh2->handle.fd;
|
||||
case ZEND_HANDLE_FP:
|
||||
return fh1->handle.fp == fh2->handle.fp;
|
||||
case ZEND_HANDLE_STREAM:
|
||||
return fh1->handle.stream.handle == fh2->handle.stream.handle;
|
||||
case ZEND_HANDLE_MAPPED:
|
||||
return (fh1->handle.stream.handle == &fh1->handle.stream &&
|
||||
fh2->handle.stream.handle == &fh2->handle.stream &&
|
||||
fh1->handle.stream.mmap.old_handle == fh2->handle.stream.mmap.old_handle)
|
||||
|| fh1->handle.stream.handle == fh2->handle.stream.handle;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
+9
-16
@@ -29,32 +29,20 @@
|
||||
* These functions are private to the engine.
|
||||
* */
|
||||
typedef size_t (*zend_stream_fsizer_t)(void* handle);
|
||||
typedef size_t (*zend_stream_reader_t)(void* handle, char *buf, size_t len);
|
||||
typedef ssize_t (*zend_stream_reader_t)(void* handle, char *buf, size_t len);
|
||||
typedef void (*zend_stream_closer_t)(void* handle);
|
||||
|
||||
#define ZEND_MMAP_AHEAD 32
|
||||
|
||||
typedef enum {
|
||||
ZEND_HANDLE_FILENAME,
|
||||
ZEND_HANDLE_FD,
|
||||
ZEND_HANDLE_FP,
|
||||
ZEND_HANDLE_STREAM,
|
||||
ZEND_HANDLE_MAPPED
|
||||
ZEND_HANDLE_STREAM
|
||||
} zend_stream_type;
|
||||
|
||||
typedef struct _zend_mmap {
|
||||
size_t len;
|
||||
size_t pos;
|
||||
void *map;
|
||||
char *buf;
|
||||
void *old_handle;
|
||||
zend_stream_closer_t old_closer;
|
||||
} zend_mmap;
|
||||
|
||||
typedef struct _zend_stream {
|
||||
void *handle;
|
||||
int isatty;
|
||||
zend_mmap mmap;
|
||||
zend_stream_reader_t reader;
|
||||
zend_stream_fsizer_t fsizer;
|
||||
zend_stream_closer_t closer;
|
||||
@@ -62,17 +50,22 @@ typedef struct _zend_stream {
|
||||
|
||||
typedef struct _zend_file_handle {
|
||||
union {
|
||||
int fd;
|
||||
FILE *fp;
|
||||
zend_stream stream;
|
||||
} handle;
|
||||
const char *filename;
|
||||
zend_string *opened_path;
|
||||
zend_stream_type type;
|
||||
zend_bool free_filename;
|
||||
/* free_filename is used by wincache */
|
||||
/* TODO: Clean up filename vs opened_path mess */
|
||||
zend_bool free_filename;
|
||||
char *buf;
|
||||
size_t len;
|
||||
} zend_file_handle;
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_stream_init_fp(zend_file_handle *handle, FILE *fp, const char *filename);
|
||||
ZEND_API void zend_stream_init_filename(zend_file_handle *handle, const char *filename);
|
||||
ZEND_API int zend_stream_open(const char *filename, zend_file_handle *handle);
|
||||
ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len);
|
||||
ZEND_API void zend_file_handle_dtor(zend_file_handle *fh);
|
||||
|
||||
+8
-2
@@ -555,9 +555,11 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
|
||||
|
||||
/* zval.u1.v.type_flags */
|
||||
#define IS_TYPE_REFCOUNTED (1<<0)
|
||||
#define IS_TYPE_COLLECTABLE (1<<1)
|
||||
|
||||
#if 1
|
||||
/* This optimized version assumes that we have a single "type_flag" */
|
||||
/* IS_TYPE_COLLECTABLE may be used only with IS_TYPE_REFCOUNTED */
|
||||
# define Z_TYPE_INFO_REFCOUNTED(t) (((t) & Z_TYPE_FLAGS_MASK) != 0)
|
||||
#else
|
||||
# define Z_TYPE_INFO_REFCOUNTED(t) (((t) & (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT)) != 0)
|
||||
@@ -567,8 +569,8 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
|
||||
#define IS_INTERNED_STRING_EX IS_STRING
|
||||
|
||||
#define IS_STRING_EX (IS_STRING | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
|
||||
#define IS_ARRAY_EX (IS_ARRAY | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
|
||||
#define IS_OBJECT_EX (IS_OBJECT | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
|
||||
#define IS_ARRAY_EX (IS_ARRAY | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT) | (IS_TYPE_COLLECTABLE << Z_TYPE_FLAGS_SHIFT))
|
||||
#define IS_OBJECT_EX (IS_OBJECT | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT) | (IS_TYPE_COLLECTABLE << Z_TYPE_FLAGS_SHIFT))
|
||||
#define IS_RESOURCE_EX (IS_RESOURCE | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
|
||||
#define IS_REFERENCE_EX (IS_REFERENCE | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
|
||||
|
||||
@@ -624,12 +626,16 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
|
||||
|
||||
#if 1
|
||||
/* This optimized version assumes that we have a single "type_flag" */
|
||||
/* IS_TYPE_COLLECTABLE may be used only with IS_TYPE_REFCOUNTED */
|
||||
#define Z_REFCOUNTED(zval) (Z_TYPE_FLAGS(zval) != 0)
|
||||
#else
|
||||
#define Z_REFCOUNTED(zval) ((Z_TYPE_FLAGS(zval) & IS_TYPE_REFCOUNTED) != 0)
|
||||
#endif
|
||||
#define Z_REFCOUNTED_P(zval_p) Z_REFCOUNTED(*(zval_p))
|
||||
|
||||
#define Z_COLLECTABLE(zval) ((Z_TYPE_FLAGS(zval) & IS_TYPE_COLLECTABLE) != 0)
|
||||
#define Z_COLLECTABLE_P(zval_p) Z_COLLECTABLE(*(zval_p))
|
||||
|
||||
/* deprecated: (COPYABLE is the same as IS_ARRAY) */
|
||||
#define Z_COPYABLE(zval) (Z_TYPE(zval) == IS_ARRAY)
|
||||
#define Z_COPYABLE_P(zval_p) Z_COPYABLE(*(zval_p))
|
||||
|
||||
+18
-1
@@ -22,7 +22,6 @@
|
||||
#define VIRTUAL_CWD_H
|
||||
|
||||
#include "TSRM.h"
|
||||
#include "tsrm_config_common.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -33,6 +32,24 @@
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <limits.h>
|
||||
|
||||
#if HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
# if _WIN32
|
||||
# include "win32/ioutil.h"
|
||||
# define MAXPATHLEN PHP_WIN32_IOUTIL_MAXPATHLEN
|
||||
# elif PATH_MAX
|
||||
# define MAXPATHLEN PATH_MAX
|
||||
# elif defined(MAX_PATH)
|
||||
# define MAXPATHLEN MAX_PATH
|
||||
# else
|
||||
# define MAXPATHLEN 256
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
#define VIRTUAL_DIR
|
||||
|
||||
+652
-431
File diff suppressed because it is too large.
Load diff
+6281
-6630
File diff suppressed because it is too large.
Load diff
+147
-38
@@ -326,7 +326,7 @@ $op1_get_zval_ptr_ptr_undef = array(
|
||||
"UNUSED" => "NULL",
|
||||
"CV" => "EX_VAR(opline->op1.var)",
|
||||
"TMPVAR" => "???",
|
||||
"TMPVARCV" => "EX_VAR(opline->op1.var)",
|
||||
"TMPVARCV" => "???",
|
||||
);
|
||||
|
||||
$op2_get_zval_ptr_ptr_undef = array(
|
||||
@@ -337,7 +337,7 @@ $op2_get_zval_ptr_ptr_undef = array(
|
||||
"UNUSED" => "NULL",
|
||||
"CV" => "EX_VAR(opline->op2.var)",
|
||||
"TMPVAR" => "???",
|
||||
"TMPVARCV" => "EX_VAR(opline->op2.var)",
|
||||
"TMPVARCV" => "???",
|
||||
);
|
||||
|
||||
$op1_get_obj_zval_ptr = array(
|
||||
@@ -436,7 +436,7 @@ $op1_get_obj_zval_ptr_ptr_undef = array(
|
||||
"UNUSED" => "&EX(This)",
|
||||
"CV" => "EX_VAR(opline->op1.var)",
|
||||
"TMPVAR" => "???",
|
||||
"TMPVARCV" => "EX_VAR(opline->op1.var)",
|
||||
"TMPVARCV" => "???",
|
||||
);
|
||||
|
||||
$op2_get_obj_zval_ptr_ptr_undef = array(
|
||||
@@ -447,7 +447,7 @@ $op2_get_obj_zval_ptr_ptr_undef = array(
|
||||
"UNUSED" => "&EX(This)",
|
||||
"CV" => "EX_VAR(opline->op2.var)",
|
||||
"TMPVAR" => "???",
|
||||
"TMPVARCV" => "EX_VAR(opline->op2.var)",
|
||||
"TMPVARCV" => "???",
|
||||
);
|
||||
|
||||
$op1_free_op = array(
|
||||
@@ -812,10 +812,8 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
|
||||
"/FREE_OP2_VAR_PTR\(\)/" => $op2_free_op_var_ptr[$op2],
|
||||
"/FREE_UNFETCHED_OP1\(\)/" => $op1_free_unfetched[$op1],
|
||||
"/FREE_UNFETCHED_OP2\(\)/" => $op2_free_unfetched[$op2],
|
||||
"/^#(\s*)ifdef\s+ZEND_VM_SPEC\s*\n/m" => ($op1!="ANY"||$op2!="ANY")?"#\\1if 1\n":"#\\1if 0\n",
|
||||
"/^#(\s*)ifndef\s+ZEND_VM_SPEC\s*\n/m" => ($op1!="ANY"||$op2!="ANY")?"#\\1if 0\n":"#\\1if 1\n",
|
||||
"/\!defined\(ZEND_VM_SPEC\)/m" => ($op1!="ANY"||$op2!="ANY")?"0":"1",
|
||||
"/defined\(ZEND_VM_SPEC\)/m" => ($op1!="ANY"||$op2!="ANY")?"1":"0",
|
||||
"/\!ZEND_VM_SPEC/m" => ($op1!="ANY"||$op2!="ANY")?"0":"1",
|
||||
"/ZEND_VM_SPEC/m" => ($op1!="ANY"||$op2!="ANY")?"1":"0",
|
||||
"/ZEND_VM_C_LABEL\(\s*([A-Za-z_]*)\s*\)/m" => "\\1".(($spec && $kind != ZEND_VM_KIND_CALL)?("_SPEC".$prefix[$op1].$prefix[$op2].extra_spec_name($extra_spec)):""),
|
||||
"/ZEND_VM_C_GOTO\(\s*([A-Za-z_]*)\s*\)/m" => "goto \\1".(($spec && $kind != ZEND_VM_KIND_CALL)?("_SPEC".$prefix[$op1].$prefix[$op2].extra_spec_name($extra_spec)):""),
|
||||
"/^#(\s*)if\s+1\s*\\|\\|.*[^\\\\]$/m" => "#\\1if 1",
|
||||
@@ -839,6 +837,18 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
|
||||
: ($extra_spec['SMART_BRANCH'] == 2 ?
|
||||
"ZEND_VM_SMART_BRANCH_JMPNZ(\\1, \\2)" : ""))
|
||||
: "ZEND_VM_SMART_BRANCH(\\1, \\2)",
|
||||
"/ZEND_VM_SMART_BRANCH_TRUE\(\s*\)/" => isset($extra_spec['SMART_BRANCH']) ?
|
||||
($extra_spec['SMART_BRANCH'] == 1 ?
|
||||
"ZEND_VM_SMART_BRANCH_TRUE_JMPZ()"
|
||||
: ($extra_spec['SMART_BRANCH'] == 2 ?
|
||||
"ZEND_VM_SMART_BRANCH_TRUE_JMPNZ()" : ""))
|
||||
: "ZEND_VM_SMART_BRANCH_TRUE()",
|
||||
"/ZEND_VM_SMART_BRANCH_FALSE\(\s*\)/" => isset($extra_spec['SMART_BRANCH']) ?
|
||||
($extra_spec['SMART_BRANCH'] == 1 ?
|
||||
"ZEND_VM_SMART_BRANCH_FALSE_JMPZ()"
|
||||
: ($extra_spec['SMART_BRANCH'] == 2 ?
|
||||
"ZEND_VM_SMART_BRANCH_FALSE_JMPNZ()" : ""))
|
||||
: "ZEND_VM_SMART_BRANCH_FALSE()",
|
||||
"/opline->extended_value\s*&\s*ZEND_ISEMPTY/" => isset($extra_spec['ISSET']) ?
|
||||
($extra_spec['ISSET'] == 0 ? "0" : "1")
|
||||
: "\\0",
|
||||
@@ -871,14 +881,19 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
|
||||
return "goto " . opcode_name($name, $spec, $op1, $op2, $extra_spec) . "_LABEL";
|
||||
} else {
|
||||
// ZEND_VM_DISPATCH_TO_HELPER
|
||||
if (is_hot_helper($matches[1])) {
|
||||
if (isset($matches[2])) {
|
||||
// extra args
|
||||
$args = preg_replace("/,\s*([A-Za-z0-9_]*)\s*,\s*([^,)\s]*)\s*/", "$1 = $2; ", $matches[2]);
|
||||
return $args . "goto " . helper_name($matches[1], $spec, $op1, $op2, $extra_spec) . "_LABEL";
|
||||
}
|
||||
return "goto " . helper_name($matches[1], $spec, $op1, $op2, $extra_spec) . "_LABEL";
|
||||
}
|
||||
if (isset($matches[2])) {
|
||||
// extra args
|
||||
$args = substr(preg_replace("/,\s*[A-Za-z_]*\s*,\s*([^,)\s]*)\s*/", ", $1", $matches[2]), 2);
|
||||
$args = substr(preg_replace("/,\s*[A-Za-z0-9_]*\s*,\s*([^,)\s]*)\s*/", ", $1", $matches[2]), 2);
|
||||
return "ZEND_VM_TAIL_CALL(" . helper_name($matches[1], $spec, $op1, $op2, $extra_spec) . "(" . $args. " ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC))";
|
||||
}
|
||||
if (is_hot_helper($matches[1])) {
|
||||
return "goto " . helper_name($matches[1], $spec, $op1, $op2, $extra_spec) . "_LABEL";
|
||||
}
|
||||
return "ZEND_VM_TAIL_CALL(" . helper_name($matches[1], $spec, $op1, $op2, $extra_spec) . "(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU))";
|
||||
}
|
||||
},
|
||||
@@ -891,16 +906,26 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
|
||||
"/ZEND_VM_DISPATCH_TO_HANDLER\(\s*([A-Z_]*)\s*\)/m",
|
||||
"/ZEND_VM_DISPATCH_TO_HELPER\(\s*([A-Za-z_]*)\s*(,[^)]*)?\)/m",
|
||||
),
|
||||
function($matches) use ($spec, $prefix, $op1, $op2, $extra_spec) {
|
||||
function($matches) use ($spec, $prefix, $op1, $op2, $extra_spec, $name) {
|
||||
if (strncasecmp($matches[0], "EXECUTE_DATA", strlen("EXECUTE_DATA")) == 0) {
|
||||
return "execute_data";
|
||||
} else if (strncasecmp($matches[0], "ZEND_VM_DISPATCH_TO_HANDLER", strlen("ZEND_VM_DISPATCH_TO_HANDLER")) == 0) {
|
||||
return "ZEND_VM_TAIL_CALL(" . opcode_name($matches[1], $spec, $op1, $op2, $extra_spec) . "_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU))";
|
||||
global $opcodes, $opnames;
|
||||
|
||||
$handler = $matches[1];
|
||||
$opcode = $opcodes[$opnames[$handler]];
|
||||
$inline =
|
||||
ZEND_VM_KIND == ZEND_VM_KIND_HYBRID &&
|
||||
isset($opcode["use"]) &&
|
||||
is_hot_handler($opcode["hot"], $op1, $op2, $extra_spec) &&
|
||||
is_hot_handler($opcodes[$opnames[$name]]["hot"], $op1, $op2, $extra_spec) ?
|
||||
"_INLINE" : "";
|
||||
return "ZEND_VM_TAIL_CALL(" . opcode_name($handler, $spec, $op1, $op2, $extra_spec) . $inline . "_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU))";
|
||||
} else {
|
||||
// ZEND_VM_DISPATCH_TO_HELPER
|
||||
if (isset($matches[2])) {
|
||||
// extra args
|
||||
$args = substr(preg_replace("/,\s*[A-Za-z_]*\s*,\s*([^,)\s]*)\s*/", ", $1", $matches[2]), 2);
|
||||
$args = substr(preg_replace("/,\s*[A-Za-z0-9_]*\s*,\s*([^,)\s]*)\s*/", ", $1", $matches[2]), 2);
|
||||
return "ZEND_VM_TAIL_CALL(" . helper_name($matches[1], $spec, $op1, $op2, $extra_spec) . "(" . $args. " ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC))";
|
||||
}
|
||||
return "ZEND_VM_TAIL_CALL(" . helper_name($matches[1], $spec, $op1, $op2, $extra_spec) . "(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU))";
|
||||
@@ -924,7 +949,7 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
|
||||
// ZEND_VM_DISPATCH_TO_HELPER
|
||||
if (isset($matches[2])) {
|
||||
// extra args
|
||||
$args = preg_replace("/,\s*([A-Za-z_]*)\s*,\s*([^,)\s]*)\s*/", "$1 = $2; ", $matches[2]);
|
||||
$args = preg_replace("/,\s*([A-Za-z0-9_]*)\s*,\s*([^,)\s]*)\s*/", "$1 = $2; ", $matches[2]);
|
||||
return $args . "goto " . helper_name($matches[1], $spec, $op1, $op2, $extra_spec);
|
||||
}
|
||||
return "goto " . helper_name($matches[1], $spec, $op1, $op2, $extra_spec);
|
||||
@@ -948,7 +973,7 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
|
||||
// ZEND_VM_DISPATCH_TO_HELPER
|
||||
if (isset($matches[2])) {
|
||||
// extra args
|
||||
$args = preg_replace("/,\s*([A-Za-z_]*)\s*,\s*([^,)\s]*)\s*/", "$1 = $2; ", $matches[2]);
|
||||
$args = preg_replace("/,\s*([A-Za-z0-9_]*)\s*,\s*([^,)\s]*)\s*/", "$1 = $2; ", $matches[2]);
|
||||
return $args . "goto " . helper_name($matches[1], $spec, $op1, $op2, $extra_spec);
|
||||
}
|
||||
return "goto " . helper_name($matches[1], $spec, $op1, $op2, $extra_spec);
|
||||
@@ -1028,6 +1053,8 @@ function is_hot_handler($hot, $op1, $op2, $extra_spec) {
|
||||
return true;
|
||||
} else if ($hot === 'HOT_NOCONST_') {
|
||||
return ($op1 !== 'CONST');
|
||||
} else if ($hot === 'HOT_NOCONSTCONST_') {
|
||||
return (($op1 !== 'CONST') || ($op2 !== 'CONST')) ;
|
||||
} else if ($hot === 'HOT_OBJ_') {
|
||||
return (($op1 === 'UNUSED') || ($op1 === 'CV')) && ($op2 === 'CONST');
|
||||
} else if ($hot === 'HOT_SEND_') {
|
||||
@@ -1048,6 +1075,8 @@ function is_cold_handler($hot, $op1, $op2, $extra_spec) {
|
||||
return ($op1 === 'CONST');
|
||||
} else if ($hot === 'HOT_NOCONST_') {
|
||||
return ($op1 === 'CONST');
|
||||
} else if ($hot === 'HOT_NOCONSTCONST_') {
|
||||
return ($op1 === 'CONST' && $op2 === 'CONST');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -1061,15 +1090,34 @@ function is_inline_hybrid_handler($name, $hot, $op1, $op2, $extra_spec) {
|
||||
function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno, $opcode, $extra_spec = null, &$switch_labels = array()) {
|
||||
global $definition_file, $prefix, $opnames, $gen_order;
|
||||
|
||||
if (isset($opcode['alias']) && ($spec || $kind != ZEND_VM_KIND_SWITCH)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($spec && skip_extra_spec_function($op1, $op2, $extra_spec)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Skip SMART_BRANCH specialization for "cold" CONST_CONST instructions */
|
||||
if (isset($extra_spec["SMART_BRANCH"])) {
|
||||
if ($opcode["hot"] === 'HOT_NOCONSTCONST_'
|
||||
|| $opcode["hot"] === 'COLD_CONSTCONST_') {
|
||||
if (($op1 === 'CONST') && ($op2 === 'CONST')) {
|
||||
if ($extra_spec["SMART_BRANCH"] == 0) {
|
||||
unset($extra_spec["SMART_BRANCH"]);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ZEND_VM_LINES) {
|
||||
out($f, "#line $lineno \"$definition_file\"\n");
|
||||
}
|
||||
|
||||
// Generate opcode handler's entry point according to selected threading model
|
||||
$additional_func = false;
|
||||
$spec_name = $name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2].($spec?extra_spec_name($extra_spec):"");
|
||||
switch($kind) {
|
||||
case ZEND_VM_KIND_HYBRID:
|
||||
@@ -1083,10 +1131,14 @@ function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno,
|
||||
. stream_get_contents($out);
|
||||
fclose($out);
|
||||
} else {
|
||||
$inline =
|
||||
isset($opcode["use"]) &&
|
||||
is_hot_handler($opcode["hot"], $op1, $op2, $extra_spec) ?
|
||||
"_INLINE" : "";
|
||||
$code =
|
||||
"\t\t\tHYBRID_CASE({$spec_name}):\n"
|
||||
. "\t\t\t\tVM_TRACE($spec_name)\n"
|
||||
. "\t\t\t\t{$spec_name}_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n"
|
||||
. "\t\t\t\t{$spec_name}{$inline}_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n"
|
||||
. "\t\t\t\tHYBRID_BREAK();\n";
|
||||
}
|
||||
if (is_array($gen_order)) {
|
||||
@@ -1097,7 +1149,12 @@ function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno,
|
||||
return;
|
||||
case ZEND_VM_KIND_CALL:
|
||||
if ($opcode["hot"] && ZEND_VM_KIND == ZEND_VM_KIND_HYBRID && is_hot_handler($opcode["hot"], $op1, $op2, $extra_spec)) {
|
||||
out($f,"static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n");
|
||||
if (isset($opcode["use"])) {
|
||||
out($f,"static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n");
|
||||
$additional_func = true;
|
||||
} else {
|
||||
out($f,"static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n");
|
||||
}
|
||||
} else if ($opcode["hot"] && is_cold_handler($opcode["hot"], $op1, $op2, $extra_spec)) {
|
||||
out($f,"static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n");
|
||||
} else {
|
||||
@@ -1126,6 +1183,14 @@ function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno,
|
||||
|
||||
// Generate opcode handler's code
|
||||
gen_code($f, $spec, $kind, 0, $code, $op1, $op2, $name, $extra_spec);
|
||||
|
||||
if ($additional_func) {
|
||||
out($f,"static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n");
|
||||
out($f,"{\n");
|
||||
out($f,"\tZEND_VM_TAIL_CALL({$spec_name}_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));\n");
|
||||
out($f,"}\n");
|
||||
out($f,"\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Generates helper
|
||||
@@ -1140,10 +1205,6 @@ function gen_helper($f, $spec, $kind, $name, $op1, $op2, $param, $code, $lineno,
|
||||
return;
|
||||
}
|
||||
|
||||
if ($spec && $name === "zend_binary_assign_op_helper") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ZEND_VM_LINES) {
|
||||
out($f, "#line $lineno \"$definition_file\"\n");
|
||||
}
|
||||
@@ -1163,7 +1224,7 @@ function gen_helper($f, $spec, $kind, $name, $op1, $op2, $param, $code, $lineno,
|
||||
if ($cold) {
|
||||
$zend_attributes = " zend_never_inline ZEND_COLD";
|
||||
} else {
|
||||
$zend_attributes = "";
|
||||
$zend_attributes = " zend_never_inline";
|
||||
}
|
||||
$zend_fastcall = " ZEND_FASTCALL";
|
||||
}
|
||||
@@ -1204,7 +1265,7 @@ function gen_null_label($f, $kind, $prolog) {
|
||||
|
||||
// Generates array of opcode handlers (specialized or unspecialized)
|
||||
function gen_labels($f, $spec, $kind, $prolog, &$specs, $switch_labels = array()) {
|
||||
global $opcodes, $op_types, $prefix, $op_types_ex;
|
||||
global $opcodes, $opnames, $op_types, $prefix, $op_types_ex;
|
||||
|
||||
$list = [];
|
||||
$next = 0;
|
||||
@@ -1214,6 +1275,10 @@ function gen_labels($f, $spec, $kind, $prolog, &$specs, $switch_labels = array()
|
||||
|
||||
// For each opcode in opcode number order
|
||||
foreach($opcodes as $num => $dsc) {
|
||||
if (isset($dsc['alias'])) {
|
||||
$specs[$num] = $specs[$opnames[$dsc['alias']]];
|
||||
continue;
|
||||
}
|
||||
$specs[$num] = "$label";
|
||||
$spec_op1 = $spec_op2 = $spec_extra = false;
|
||||
$def_op1_type = $def_op2_type = "ANY";
|
||||
@@ -1357,6 +1422,16 @@ function gen_labels($f, $spec, $kind, $prolog, &$specs, $switch_labels = array()
|
||||
return;
|
||||
}
|
||||
|
||||
/* Skip SMART_BRANCH specialization for "cold" CONST_CONST instructions */
|
||||
if (isset($extra_spec["SMART_BRANCH"])) {
|
||||
if ($dsc["hot"] === 'HOT_NOCONSTCONST_'
|
||||
|| $dsc["hot"] === 'COLD_CONSTCONST_') {
|
||||
if (($op1 === 'CONST') && ($op2 === 'CONST')) {
|
||||
unset($extra_spec["SMART_BRANCH"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Emit pointer to specialized handler
|
||||
$spec_name = $dsc["op"]."_SPEC".$prefix[$op1].$prefix[$op2].extra_spec_name($extra_spec);
|
||||
switch ($kind) {
|
||||
@@ -1425,8 +1500,18 @@ function gen_labels($f, $spec, $kind, $prolog, &$specs, $switch_labels = array()
|
||||
}
|
||||
$next = $num+1;
|
||||
|
||||
//ugly trick for ZEND_VM_DEFINE_OP
|
||||
if ($dsc["code"]) {
|
||||
if (isset($dsc['alias']) && $kind != ZEND_VM_KIND_SWITCH) {
|
||||
// Emit pointer to unspecialized handler
|
||||
switch ($kind) {
|
||||
case ZEND_VM_KIND_CALL:
|
||||
out($f,$prolog.$dsc['alias']."_HANDLER,\n");
|
||||
break;
|
||||
case ZEND_VM_KIND_GOTO:
|
||||
out($f,$prolog."(void*)&&".$dsc['alias']."_LABEL,\n");
|
||||
break;
|
||||
}
|
||||
$list[] = $dsc["op"];
|
||||
} else if ($dsc["code"]) { //ugly trick for ZEND_VM_DEFINE_OP
|
||||
// Emit pointer to unspecialized handler
|
||||
switch ($kind) {
|
||||
case ZEND_VM_KIND_CALL:
|
||||
@@ -1845,8 +1930,8 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
|
||||
out($f,"# define ZEND_VM_RETURN() return -1\n");
|
||||
if ($kind == ZEND_VM_KIND_HYBRID) {
|
||||
out($f,"# define ZEND_VM_HOT\n");
|
||||
out($f,"# define ZEND_VM_COLD ZEND_COLD ZEND_OPT_SIZE\n");
|
||||
}
|
||||
out($f,"# define ZEND_VM_COLD ZEND_COLD ZEND_OPT_SIZE\n");
|
||||
out($f,"#endif\n");
|
||||
out($f,"\n");
|
||||
out($f,"typedef ZEND_OPCODE_HANDLER_RET (ZEND_FASTCALL *opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);\n");
|
||||
@@ -2003,14 +2088,22 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
|
||||
out($f, $m[1].$executor_name.$m[3]."\n");
|
||||
break;
|
||||
case "HELPER_VARS":
|
||||
if ($kind != ZEND_VM_KIND_CALL && $kind != ZEND_VM_KIND_HYBRID) {
|
||||
if ($kind == ZEND_VM_KIND_SWITCH) {
|
||||
out($f,$m[1]."const void *dispatch_handler;\n");
|
||||
if ($kind == ZEND_VM_KIND_SWITCH) {
|
||||
out($f,$m[1]."const void *dispatch_handler;\n");
|
||||
}
|
||||
if ($kind != ZEND_VM_KIND_CALL && count($params)) {
|
||||
if ($kind == ZEND_VM_KIND_HYBRID) {
|
||||
out($f, "#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
|
||||
}
|
||||
// Emit local variables those are used for helpers' parameters
|
||||
foreach ($params as $param => $x) {
|
||||
out($f,$m[1].$param.";\n");
|
||||
}
|
||||
if ($kind == ZEND_VM_KIND_HYBRID) {
|
||||
out($f, "#endif\n");
|
||||
}
|
||||
}
|
||||
if ($kind != ZEND_VM_KIND_CALL && $kind != ZEND_VM_KIND_HYBRID) {
|
||||
out($f,"#ifdef ZEND_VM_FP_GLOBAL_REG\n");
|
||||
out($f,$m[1]."register zend_execute_data *execute_data __asm__(ZEND_VM_FP_GLOBAL_REG) = ex;\n");
|
||||
out($f,"#else\n");
|
||||
@@ -2301,6 +2394,7 @@ function gen_vm($def, $skel) {
|
||||
strpos($line,"ZEND_VM_INLINE_HANDLER(") === 0 ||
|
||||
strpos($line,"ZEND_VM_HOT_HANDLER(") === 0 ||
|
||||
strpos($line,"ZEND_VM_HOT_NOCONST_HANDLER(") === 0 ||
|
||||
strpos($line,"ZEND_VM_HOT_NOCONSTCONST_HANDLER(") === 0 ||
|
||||
strpos($line,"ZEND_VM_HOT_SEND_HANDLER(") === 0 ||
|
||||
strpos($line,"ZEND_VM_HOT_OBJ_HANDLER(") === 0 ||
|
||||
strpos($line,"ZEND_VM_COLD_HANDLER(") === 0 ||
|
||||
@@ -2308,7 +2402,7 @@ function gen_vm($def, $skel) {
|
||||
strpos($line,"ZEND_VM_COLD_CONSTCONST_HANDLER(") === 0) {
|
||||
// Parsing opcode handler's definition
|
||||
if (preg_match(
|
||||
"/^ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_|COLD_|COLD_CONST_|COLD_CONSTCONST_)?HANDLER\(\s*([0-9]+)\s*,\s*([A-Z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
|
||||
"/^ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_|HOT_NOCONSTCONST_|COLD_|COLD_CONST_|COLD_CONSTCONST_)?HANDLER\(\s*([0-9]+)\s*,\s*([A-Z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
|
||||
$line,
|
||||
$m) == 0) {
|
||||
die("ERROR ($def:$lineno): Invalid ZEND_VM_HANDLER definition.\n");
|
||||
@@ -2354,11 +2448,12 @@ function gen_vm($def, $skel) {
|
||||
strpos($line,"ZEND_VM_INLINE_TYPE_SPEC_HANDLER(") === 0 ||
|
||||
strpos($line,"ZEND_VM_HOT_TYPE_SPEC_HANDLER(") === 0 ||
|
||||
strpos($line,"ZEND_VM_HOT_NOCONST_TYPE_SPEC_HANDLER(") === 0 ||
|
||||
strpos($line,"ZEND_VM_HOT_NOCONSTCONST_TYPE_SPEC_HANDLER(") === 0 ||
|
||||
strpos($line,"ZEND_VM_HOT_SEND_TYPE_SPEC_HANDLER(") === 0 ||
|
||||
strpos($line,"ZEND_VM_HOT_OBJ_TYPE_SPEC_HANDLER(") === 0) {
|
||||
// Parsing opcode handler's definition
|
||||
if (preg_match(
|
||||
"/^ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_)?TYPE_SPEC_HANDLER\(\s*([A-Z_]+)\s*,\s*((?:[^(,]|\([^()]*|(?R)*\))*),\s*([A-Za-z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
|
||||
"/^ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_|HOT_NOCONSTCONST_)?TYPE_SPEC_HANDLER\(\s*([A-Z_]+)\s*,\s*((?:[^(,]|\([^()]*|(?R)*\))*),\s*([A-Za-z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
|
||||
$line,
|
||||
$m) == 0) {
|
||||
die("ERROR ($def:$lineno): Invalid ZEND_VM_TYPE_HANDLER_HANDLER definition.\n");
|
||||
@@ -2421,10 +2516,14 @@ function gen_vm($def, $skel) {
|
||||
}
|
||||
|
||||
// Store parameters
|
||||
foreach (explode(",", $param) as $p) {
|
||||
$p = trim($p);
|
||||
if ($p !== "") {
|
||||
$params[$p] = 1;
|
||||
if (ZEND_VM_KIND == ZEND_VM_KIND_GOTO
|
||||
|| ZEND_VM_KIND == ZEND_VM_KIND_SWITCH
|
||||
|| (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID && $hot)) {
|
||||
foreach (explode(",", $param) as $p) {
|
||||
$p = trim($p);
|
||||
if ($p !== "") {
|
||||
$params[$p] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2496,7 +2595,17 @@ function gen_vm($def, $skel) {
|
||||
|
||||
// Search for opcode handlers those are used by other opcode handlers
|
||||
foreach ($opcodes as $dsc) {
|
||||
if (preg_match_all("/ZEND_VM_DISPATCH_TO_HANDLER\(\s*([A-Z_]*)\s*\)/m", $dsc["code"], $mm, PREG_SET_ORDER)) {
|
||||
if (preg_match("/^\s*{\s*ZEND_VM_DISPATCH_TO_HANDLER\(\s*([A-Z_]*)\s*\)\s*;\s*}\s*/", $dsc["code"], $m)) {
|
||||
$op = $m[1];
|
||||
if (!isset($opnames[$op])) {
|
||||
die("ERROR ($def:$lineno): Opcode with name '$op' is not defined.\n");
|
||||
}
|
||||
$opcodes[$opnames[$dsc['op']]]['alias'] = $op;
|
||||
if (!ZEND_VM_SPEC && ZEND_VM_KIND == ZEND_VM_KIND_SWITCH) {
|
||||
$code = $opnames[$op];
|
||||
$opcodes[$code]['use'] = 1;
|
||||
}
|
||||
} else if (preg_match_all("/ZEND_VM_DISPATCH_TO_HANDLER\(\s*([A-Z_]*)\s*\)/m", $dsc["code"], $mm, PREG_SET_ORDER)) {
|
||||
foreach ($mm as $m) {
|
||||
$op = $m[1];
|
||||
if (!isset($opnames[$op])) {
|
||||
|
||||
+1678
-1590
File diff suppressed because it is too large.
Load diff
+16
-16
@@ -222,17 +222,17 @@ static const char *zend_vm_opcodes_names[195] = {
|
||||
|
||||
static uint32_t zend_vm_opcodes_flags[195] = {
|
||||
0x00000000,
|
||||
0x00000b0b,
|
||||
0x00000b0b,
|
||||
0x80000b0b,
|
||||
0x00000707,
|
||||
0x00000707,
|
||||
0x80000707,
|
||||
0x00000707,
|
||||
0x00000707,
|
||||
0x00000707,
|
||||
0x00000707,
|
||||
0x00000b0b,
|
||||
0x00000b0b,
|
||||
0x00000b0b,
|
||||
0x40000707,
|
||||
0x80000707,
|
||||
0x80000707,
|
||||
0x80000707,
|
||||
0x80000b0b,
|
||||
0x80000b0b,
|
||||
0x80000b0b,
|
||||
0x00000707,
|
||||
0x00000007,
|
||||
0x00000007,
|
||||
@@ -241,8 +241,8 @@ static uint32_t zend_vm_opcodes_flags[195] = {
|
||||
0x80000303,
|
||||
0x80000707,
|
||||
0x80000707,
|
||||
0x00000707,
|
||||
0x00000707,
|
||||
0x00000b0b,
|
||||
0x00000b0b,
|
||||
0x00000301,
|
||||
0x00006701,
|
||||
0x00040751,
|
||||
@@ -363,11 +363,11 @@ static uint32_t zend_vm_opcodes_flags[195] = {
|
||||
0x00000000,
|
||||
0x00000101,
|
||||
0x00000000,
|
||||
0x00000103,
|
||||
0x00040103,
|
||||
0x00000303,
|
||||
0x00000003,
|
||||
0x00000303,
|
||||
0x03000000,
|
||||
0x00040000,
|
||||
0x00000000,
|
||||
0x00060757,
|
||||
0x00000000,
|
||||
@@ -390,7 +390,7 @@ static uint32_t zend_vm_opcodes_flags[195] = {
|
||||
0x00000003,
|
||||
0x00000105,
|
||||
0x00040301,
|
||||
0x00002007,
|
||||
0x00002003,
|
||||
0x00000707,
|
||||
0x00000101,
|
||||
0x00000103,
|
||||
@@ -411,8 +411,8 @@ static uint32_t zend_vm_opcodes_flags[195] = {
|
||||
0x0300030b,
|
||||
0x0300030b,
|
||||
0x01000303,
|
||||
0x00000103,
|
||||
0x00000103,
|
||||
0x00000107,
|
||||
0x00000107,
|
||||
0x00000101,
|
||||
0x00000103,
|
||||
0x00000707,
|
||||
|
||||
@@ -15,7 +15,6 @@ steps:
|
||||
libenchant-dev \
|
||||
libaspell-dev \
|
||||
libpspell-dev \
|
||||
librecode-dev \
|
||||
libsasl2-dev \
|
||||
libxpm-dev \
|
||||
libzip-dev \
|
||||
|
||||
@@ -22,7 +22,6 @@ steps:
|
||||
libenchant-dev:i386 \
|
||||
libaspell-dev:i386 \
|
||||
libpspell-dev:i386 \
|
||||
librecode-dev:i386 \
|
||||
libsasl2-dev:i386 \
|
||||
libxpm-dev:i386 \
|
||||
libjpeg-dev:i386 \
|
||||
|
||||
@@ -2,9 +2,6 @@ parameters:
|
||||
packages: ''
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
displayName: 'Install Homebrew'
|
||||
- script: |
|
||||
brew install pkg-config \
|
||||
autoconf \
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
# +----------------------------------------------------------------------+
|
||||
# | PHP Version 7 |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Copyright (c) The PHP Group |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | This source file is subject to version 3.01 of the PHP license, |
|
||||
# | that is bundled with this package in the file LICENSE, and is |
|
||||
# | available through the world-wide-web at the following url: |
|
||||
# | http://www.php.net/license/3_01.txt |
|
||||
# | If you did not receive a copy of the PHP license and are unable to |
|
||||
# | obtain it through the world-wide-web, please send a note to |
|
||||
# | license@php.net so we can mail you a copy immediately. |
|
||||
# +----------------------------------------------------------------------+
|
||||
# | Author: Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
#
|
||||
# Makefile to generate build tools
|
||||
#
|
||||
|
||||
config_h_in = main/php_config.h.in
|
||||
PHP_AUTOCONF = autoconf
|
||||
PHP_AUTOHEADER = autoheader
|
||||
PHP_AUTOCONF_FLAGS = -f
|
||||
|
||||
all: configure $(config_h_in)
|
||||
|
||||
configure: configure.ac $(PHP_M4_FILES)
|
||||
# Remove aclocal.m4 if present. It is automatically included by autoconf but
|
||||
# not used by the PHP build system since PHP 7.4.
|
||||
@echo rebuilding $@
|
||||
@rm -f $@ aclocal.m4
|
||||
@$(PHP_AUTOCONF) $(PHP_AUTOCONF_FLAGS)
|
||||
|
||||
$(config_h_in): configure
|
||||
# Explicitly remove target since autoheader does not seem to work correctly
|
||||
# otherwise (timestamps are not updated). Also disable PACKAGE_* symbols in the
|
||||
# generated php_config.h.in template.
|
||||
@echo rebuilding $@
|
||||
@rm -f $@
|
||||
@$(PHP_AUTOHEADER) $(PHP_AUTOCONF_FLAGS)
|
||||
@sed -e 's/^#undef PACKAGE_[^ ]*/\/\* & \*\//g' < $@ > $@.tmp && mv $@.tmp $@
|
||||
+16
-20
@@ -1322,26 +1322,6 @@ if test "$ac_cv_struct_flock" = "yes" ; then
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl PHP_SOCKLEN_T
|
||||
dnl
|
||||
AC_DEFUN([PHP_SOCKLEN_T],[
|
||||
AC_CACHE_CHECK(for socklen_t,ac_cv_socklen_t,
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
]],[[
|
||||
socklen_t x;
|
||||
]])],[
|
||||
ac_cv_socklen_t=yes
|
||||
],[
|
||||
ac_cv_socklen_t=no
|
||||
]))
|
||||
if test "$ac_cv_socklen_t" = "yes"; then
|
||||
AC_DEFINE(HAVE_SOCKLEN_T, 1, [Whether you have socklen_t])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl PHP_MISSING_FCLOSE_DECL
|
||||
dnl
|
||||
@@ -2715,3 +2695,19 @@ int main() {
|
||||
AC_DEFINE_UNQUOTED(AS_TR_CPP([PHP_HAVE_$1_INSTRUCTIONS]),
|
||||
[$have_ext_instructions], [Whether the compiler supports $1 instructions])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl PHP_PATCH_CONFIG_HEADERS([FILE])
|
||||
dnl
|
||||
dnl PACKAGE_* symbols are automatically defined by Autoconf. When including
|
||||
dnl configuration header, warnings about redefined symbols are emitted for such
|
||||
dnl symbols if they are defined by multiple libraries. This disables all
|
||||
dnl PACKAGE_* symbols in the generated configuration header template FILE. For
|
||||
dnl example, main/php_config.h.in for PHP or config.h.in for PHP extensions.
|
||||
dnl
|
||||
AC_DEFUN([PHP_PATCH_CONFIG_HEADERS], [
|
||||
AC_MSG_NOTICE([patching $1])
|
||||
|
||||
$SED -e 's/^#undef PACKAGE_[^ ]*/\/\* & \*\//g' < $srcdir/$1 \
|
||||
> $srcdir/$1.tmp && mv $srcdir/$1.tmp $srcdir/$1
|
||||
])
|
||||
@@ -2,7 +2,6 @@
|
||||
#
|
||||
# A wrapper around Autoconf that generates files to build PHP on *nix systems.
|
||||
|
||||
MAKE=${MAKE:-make}
|
||||
PHP_AUTOCONF=${PHP_AUTOCONF:-autoconf}
|
||||
PHP_AUTOHEADER=${PHP_AUTOHEADER:-autoheader}
|
||||
force=0
|
||||
@@ -38,15 +37,13 @@ SYNOPSIS:
|
||||
buildconf [<options>]
|
||||
|
||||
OPTIONS:
|
||||
-f, --force Clean cache and overwrite configure files.
|
||||
-f, --force Regenerate configure files in PHP release packages.
|
||||
--debug Display warnings emitted by Autoconf.
|
||||
-h, --help Display this help.
|
||||
|
||||
ENVIRONMENT:
|
||||
The following optional variables are supported:
|
||||
|
||||
MAKE Overrides the path to make tool.
|
||||
MAKE=/path/to/make ./buildconf
|
||||
PHP_AUTOCONF Overrides the path to autoconf tool.
|
||||
PHP_AUTOCONF=/path/to/autoconf ./buildconf
|
||||
PHP_AUTOHEADER Overrides the path to autoheader tool.
|
||||
@@ -66,24 +63,18 @@ HELP
|
||||
shift
|
||||
done
|
||||
|
||||
if test "$dev" = "0" -a "$force" = "0"; then
|
||||
if test -f "configure"; then
|
||||
echo "The configure script has already been built for you. All done."
|
||||
echo "Run ./configure to proceed with customizing the PHP build."
|
||||
if test "$dev" = "0" && test "$force" = "0"; then
|
||||
if test -f "configure" && test -f "main/php_config.h.in"; then
|
||||
echo "buildconf: The configure script is already built. All done."
|
||||
echo " Run ./configure to proceed with customizing the PHP build."
|
||||
exit 0
|
||||
else
|
||||
echo "Configure script is missing." >&2
|
||||
echo "Run ./buildconf --force to create a configure script." >&2
|
||||
echo "buildconf: Configure files are missing." >&2
|
||||
echo " Run ./buildconf --force to create a configure script." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$force" = "1"; then
|
||||
echo "buildconf: Forcing buildconf"
|
||||
echo "buildconf: Removing configure caches and files"
|
||||
rm -rf autom4te.cache config.cache configure
|
||||
fi
|
||||
|
||||
echo "buildconf: Checking installation"
|
||||
|
||||
# Get minimum required autoconf version from the configure.ac file.
|
||||
@@ -114,23 +105,33 @@ else
|
||||
echo "buildconf: autoconf version $ac_version (ok)"
|
||||
fi
|
||||
|
||||
# Check if make exists.
|
||||
if ! test -x "$(command -v $MAKE)"; then
|
||||
echo "buildconf: make not found." >&2
|
||||
echo " You need to have make installed to build PHP." >&2
|
||||
exit 1
|
||||
if test "$force" = "1"; then
|
||||
echo "buildconf: Forcing buildconf. The configure files will be regenerated."
|
||||
fi
|
||||
|
||||
echo "buildconf: Building configure files"
|
||||
# Clean cache and explicitly remove all targets if present. Remove also
|
||||
# aclocal.m4 if present. It is automatically included by autoconf but not used
|
||||
# by the PHP build system since PHP 7.4.
|
||||
echo "buildconf: Cleaning cache and configure files"
|
||||
rm -rf \
|
||||
aclocal.m4 \
|
||||
autom4te.cache \
|
||||
config.cache \
|
||||
configure \
|
||||
main/php_config.h.in
|
||||
|
||||
if test "$debug" = "1"; then
|
||||
autoconf_flags="-f -Wall"
|
||||
autoheader_flags="-Wall"
|
||||
else
|
||||
autoconf_flags="-f"
|
||||
autoheader_flags=""
|
||||
fi
|
||||
|
||||
$MAKE -s -f build/build.mk \
|
||||
PHP_AUTOCONF="$PHP_AUTOCONF" \
|
||||
PHP_AUTOHEADER="$PHP_AUTOHEADER" \
|
||||
PHP_AUTOCONF_FLAGS="$autoconf_flags" \
|
||||
PHP_M4_FILES="$(echo TSRM/*.m4 Zend/Zend.m4 build/*.m4 ext/*/config*.m4 sapi/*/config*.m4)"
|
||||
echo "buildconf: Rebuilding configure"
|
||||
$PHP_AUTOCONF $autoconf_flags
|
||||
|
||||
echo "buildconf: Rebuilding main/php_config.h.in"
|
||||
$PHP_AUTOHEADER $autoheader_flags
|
||||
|
||||
echo "buildconf: Run ./configure to proceed with customizing the PHP build."
|
||||
+17
-39
@@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice.
|
||||
dnl ----------------------------------------------------------------------------
|
||||
|
||||
AC_PREREQ([2.68])
|
||||
AC_INIT([PHP],[7.4.0alpha3],[https://bugs.php.net],[php],[https://www.php.net])
|
||||
AC_INIT([PHP],[7.4.0beta2],[https://bugs.php.net],[php],[https://www.php.net])
|
||||
AC_CONFIG_SRCDIR([main/php_version.h])
|
||||
AC_CONFIG_AUX_DIR([build])
|
||||
AC_PRESERVE_HELP_ORDER
|
||||
@@ -27,6 +27,7 @@ PHP_CONFIG_NICE(config.nice)
|
||||
PHP_CANONICAL_HOST_TARGET
|
||||
|
||||
AC_CONFIG_HEADERS([main/php_config.h])
|
||||
|
||||
AH_TOP([
|
||||
#ifndef PHP_CONFIG_H
|
||||
#define PHP_CONFIG_H
|
||||
@@ -104,8 +105,6 @@ extern "C++" {
|
||||
#endif
|
||||
#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */
|
||||
|
||||
#undef PTHREADS
|
||||
|
||||
#endif /* PHP_CONFIG_H */
|
||||
])
|
||||
|
||||
@@ -279,7 +278,6 @@ case $host_alias in
|
||||
CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
|
||||
fi
|
||||
fi
|
||||
php_multiple_shlib_versions_ok=yes
|
||||
;;
|
||||
*mips*)
|
||||
CPPFLAGS="$CPPFLAGS -D_XPG_IV"
|
||||
@@ -400,8 +398,6 @@ PHP_CHECK_FUNC(socketpair, socket)
|
||||
PHP_CHECK_FUNC(htonl, socket)
|
||||
PHP_CHECK_FUNC(gethostname, nsl)
|
||||
PHP_CHECK_FUNC(gethostbyaddr, nsl)
|
||||
PHP_CHECK_FUNC(yp_get_default_domain, nsl)
|
||||
|
||||
PHP_CHECK_FUNC(dlopen, dl)
|
||||
PHP_CHECK_FUNC(dlsym, dl)
|
||||
if test "$ac_cv_func_dlopen" = "yes"; then
|
||||
@@ -502,7 +498,15 @@ AC_STRUCT_TIMEZONE
|
||||
PHP_MISSING_TIME_R_DECL
|
||||
PHP_MISSING_FCLOSE_DECL
|
||||
PHP_STRUCT_FLOCK
|
||||
PHP_SOCKLEN_T
|
||||
|
||||
AC_CHECK_TYPES(socklen_t, [], [], [
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
])
|
||||
|
||||
dnl These are defined elsewhere than stdio.h.
|
||||
PHP_CHECK_SIZEOF(intmax_t, 0)
|
||||
@@ -546,13 +550,9 @@ PHP_CHECK_CPU_SUPPORTS([avx2])
|
||||
dnl Check for structure members.
|
||||
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
|
||||
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
|
||||
dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exist. The
|
||||
dnl WARNING_LEVEL required because cc in QNX hates -w option without an argument
|
||||
dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exist.
|
||||
if test "`uname -s 2>/dev/null`" != "QNX"; then
|
||||
AC_STRUCT_ST_BLOCKS
|
||||
else
|
||||
AC_MSG_WARN([warnings level for cc set to 0])
|
||||
WARNING_LEVEL=0
|
||||
fi
|
||||
|
||||
dnl Checks for types.
|
||||
@@ -594,7 +594,6 @@ fpclass \
|
||||
ftok \
|
||||
funopen \
|
||||
gai_strerror \
|
||||
gcvt \
|
||||
getcwd \
|
||||
getloadavg \
|
||||
getlogin \
|
||||
@@ -614,10 +613,7 @@ grantpt \
|
||||
inet_ntoa \
|
||||
inet_ntop \
|
||||
inet_pton \
|
||||
isascii \
|
||||
link \
|
||||
localtime_r \
|
||||
lockf \
|
||||
lchown \
|
||||
mbrlen \
|
||||
memmove \
|
||||
@@ -633,11 +629,8 @@ rand_r \
|
||||
scandir \
|
||||
setitimer \
|
||||
setenv \
|
||||
setsockopt \
|
||||
setvbuf \
|
||||
shutdown \
|
||||
sigprocmask \
|
||||
sin \
|
||||
statfs \
|
||||
statvfs \
|
||||
std_syslog \
|
||||
@@ -647,7 +640,6 @@ strnlen \
|
||||
strptime \
|
||||
strtok_r \
|
||||
symlink \
|
||||
tempnam \
|
||||
tzset \
|
||||
unlockpt \
|
||||
unsetenv \
|
||||
@@ -1226,7 +1218,7 @@ fi
|
||||
|
||||
dnl Align segments on huge page boundary
|
||||
case $host_alias in
|
||||
*linux*)
|
||||
i[[3456]]86-*-linux-* | x86_64-*-linux-*)
|
||||
EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152"
|
||||
;;
|
||||
esac
|
||||
@@ -1428,7 +1420,6 @@ PHP_SUBST_OLD(PHP_VERSION)
|
||||
PHP_SUBST_OLD(PHP_VERSION_ID)
|
||||
PHP_SUBST(SHELL)
|
||||
PHP_SUBST(SHARED_LIBTOOL)
|
||||
PHP_SUBST(WARNING_LEVEL)
|
||||
PHP_SUBST(PHP_FRAMEWORKS)
|
||||
PHP_SUBST(PHP_FRAMEWORKPATH)
|
||||
PHP_SUBST(INSTALL_HEADERS)
|
||||
@@ -1441,12 +1432,6 @@ if test "$PHP_THREAD_SAFETY" = "yes" && test -n "$ac_cv_pthreads_cflags"; then
|
||||
CPPFLAGS="$CPPFLAGS $ac_cv_pthreads_cflags"
|
||||
fi
|
||||
|
||||
dnl This will go away, if we have a facility to run per-extension code after the
|
||||
dnl thread_safety decision was done.
|
||||
if test "$PHP_THREAD_SAFETY" = "yes" && test "$PHP_MYSQL" = "yes"; then
|
||||
CPPFLAGS="$CPPFLAGS -DTHREAD=1"
|
||||
fi
|
||||
|
||||
if test "$PHP_WERROR" = "yes"; then
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
CPPFLAGS="$CPPFLAGS -Werror"
|
||||
@@ -1459,16 +1444,6 @@ dnl
|
||||
PHP_HELP_SEPARATOR([Libtool:])
|
||||
PHP_CONFIGURE_PART(Configuring libtool)
|
||||
|
||||
LDFLAGS="$LDFLAGS $PHP_AIX_LDFLAGS"
|
||||
|
||||
dnl Autoconf 2.13's libtool checks go slightly nuts on Mac OS X 10.5 and 10.6.
|
||||
dnl This hack works around it. Ugly.
|
||||
case $host_alias in
|
||||
*darwin9*|*darwin10*)
|
||||
ac_cv_exeext=
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Silence warning: `ar: 'u' modifier ignored since 'D' is the default`
|
||||
dnl See https://github.com/php/php-src/pull/3017
|
||||
AC_SUBST(AR_FLAGS, [cr])
|
||||
@@ -1520,7 +1495,7 @@ PHP_SUBST(install_binary_targets)
|
||||
|
||||
PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/])
|
||||
|
||||
PHP_ADD_SOURCES(TSRM, TSRM.c tsrm_strtok_r.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
|
||||
PHP_ADD_SOURCES(TSRM, TSRM.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
|
||||
|
||||
PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c \
|
||||
fopen_wrappers.c alloca.c php_scandir.c \
|
||||
@@ -1585,6 +1560,9 @@ $PHP_OUTPUT_FILES"
|
||||
|
||||
dnl Generate build files.
|
||||
AC_CONFIG_FILES([$ALL_OUTPUT_FILES])
|
||||
|
||||
AC_CONFIG_COMMANDS_PRE([PHP_PATCH_CONFIG_HEADERS([main/php_config.h.in])])
|
||||
|
||||
AC_CONFIG_COMMANDS([default],[
|
||||
cat <<X
|
||||
|
||||
|
||||
+25
-14
@@ -91,7 +91,13 @@
|
||||
5. Bump the version numbers in `main/php_version.h`, `Zend/zend.h`,
|
||||
`configure.ac` and possibly `NEWS`. Do not use abbreviations for alpha and
|
||||
beta. Do not use dashes, you should `#define PHP_VERSION "7.4.22RC1"` and
|
||||
not `#define PHP_VERSION "7.4.22-RC1"`
|
||||
not `#define PHP_VERSION "7.4.22-RC1"`.
|
||||
|
||||
When releasing the first alpha version, bump also API version numbers in
|
||||
`Zend/zend_extensions.h`, `Zend/zend_modules.h`, and `main/php.h`. The API
|
||||
versions between the alpha/beta/.0RCx releases can be left the same or
|
||||
bumped as little as possible because PHP extensions will need to be rebuilt
|
||||
with each bump.
|
||||
|
||||
6. Compile and run `make test`, with and without ZTS, using the right Bison and
|
||||
re2c version (for PHP 7.4, minimum Bison 3.0.0 and re2c 0.13.4 are used).
|
||||
@@ -112,13 +118,13 @@
|
||||
|
||||
10. Bump the version numbers in `main/php_version.h`, `Zend/zend.h`,
|
||||
`configure.ac` and `NEWS` in the *main* branch (PHP-7.4 for example) to
|
||||
prepare for the **next** version. F.e. if the RC is "7.4.1RC1" then the new
|
||||
one should be `7.4.2-dev` - regardless if we get a new RC or not. This is to
|
||||
make sure `version_compare()` can correctly work. Commit the changes to the
|
||||
main branch.
|
||||
prepare for the **next** version. For example, if the RC is "7.4.1RC1" then
|
||||
the new one should be `7.4.2-dev` - regardless if we get a new RC or not.
|
||||
This is to make sure `version_compare()` can correctly work. Commit the
|
||||
changes to the main branch.
|
||||
|
||||
11. Push the changes to the main repo, the tag, the main branch and the release
|
||||
branch. Release branches for alpha/beta/.0RCx releases before to GA release
|
||||
branch. Release branches for alpha/beta/.0RCx releases before the GA release
|
||||
don't need to be pushed (a local temporary branch should be used).
|
||||
|
||||
```sh
|
||||
@@ -139,7 +145,7 @@
|
||||
have this directory, create it.
|
||||
|
||||
15. Now the RC can be found on https://downloads.php.net/~yourname,
|
||||
f.e. https://downloads.php.net/~derick/.
|
||||
e.g. https://downloads.php.net/~derick/.
|
||||
|
||||
16. Once the release has been tagged, contact the release-managers@ distribution
|
||||
list so that Windows binaries can be created. Once those are made, they can
|
||||
@@ -204,7 +210,7 @@
|
||||
`Zend/zend.h`, `configure.ac` and possibly `NEWS`.
|
||||
|
||||
2. If a CVE commit needs to be merged to the release, then have it committed to
|
||||
the base branches and merged upwards as usual (f.e commit the CVE fix to
|
||||
the base branches and merged upwards as usual (e.g. commit the CVE fix to
|
||||
7.2, merge to 7.3, 7.4 etc...). Then you can cherry-pick it in your release
|
||||
branch. Don't forget to update `NEWS` manually in an extra commit then.
|
||||
|
||||
@@ -219,9 +225,9 @@
|
||||
|
||||
6. Check `./sapi/cli/php -v` output for version matching.
|
||||
|
||||
7. Tag the repository with the version f.e. `git tag -u YOURKEYID php-7.4.1`
|
||||
7. Tag the repository with the version e.g. `git tag -u YOURKEYID php-7.4.1`
|
||||
|
||||
8. Push the tag f.e. `git push origin php-7.4.1`.
|
||||
8. Push the tag e.g. `git push origin php-7.4.1`.
|
||||
|
||||
9. Run: `./scripts/dev/makedist php-7.4.1`, this will export the tag,
|
||||
create configure and build three tarballs (gz, bz2 and xz). Check if the
|
||||
@@ -289,7 +295,7 @@
|
||||
|
||||
5. Update the ChangeLog file for the given major version
|
||||
|
||||
f.e. `ChangeLog-7.php` from the `NEWS` file
|
||||
e.g. `ChangeLog-7.php` from the `NEWS` file
|
||||
|
||||
* Go over the list and put every element on one line.
|
||||
* Check for `&`, `<` and `>` and escape them if necessary.
|
||||
@@ -319,7 +325,7 @@
|
||||
|
||||
8. **Check website has been synced before announcing or pushing news**
|
||||
|
||||
Try, f.e. https://www.php.net/distributions/php-7.4.0.tar.xz
|
||||
Try, e.g. https://www.php.net/distributions/php-7.4.0.tar.xz
|
||||
|
||||
Website may update slowly (may take an hour).
|
||||
|
||||
@@ -378,8 +384,13 @@
|
||||
Add a commit on master after the branch point clearing the `NEWS`,
|
||||
`UPGRADING` and `UPGRADING.INTERNALS` files, updating the version in
|
||||
`configure.ac` (run `./configure` to automatically update
|
||||
`main/php_versions.h`, too) and `Zend/zend.h`. Also list the new branch in
|
||||
`CONTRIBUTING.md`.
|
||||
`main/php_versions.h`, too) and `Zend/zend.h`. Bump the default initial
|
||||
version also in `win32/build/confutils.js`.
|
||||
|
||||
Also list the new branch in `CONTRIBUTING.md`.
|
||||
|
||||
Bump API version numbers in `Zend/zend_extensions.h`, `Zend/zend_modules.h`,
|
||||
and `main/php.h`.
|
||||
|
||||
Example: https://git.php.net/?p=php-src.git;a=commit;h=a63c99b
|
||||
Push the new branch and the commit just added to master.
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
--TEST--
|
||||
Bug #71263: fread() does not detects decoding errors from filter bzip2.decompress
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// Should notices be generated?
|
||||
|
||||
function test($case) {
|
||||
$plain = "The quick brown fox jumps over the lazy dog.";
|
||||
$fn = "bug71263.bz2";
|
||||
$compressed = (string) bzcompress($plain);
|
||||
echo "Compressed len = ", strlen($compressed), "\n";
|
||||
|
||||
if ($case == 1) {
|
||||
// Set a random byte in the middle of the compressed data
|
||||
// --> php_bz2_decompress_filter() detects fatal error
|
||||
// --> fread() displays empty string then garbage, no errors detected:
|
||||
$compressed[strlen($compressed) - 15] = 'X';
|
||||
} else if ($case == 2) {
|
||||
// Truncate the compressed data
|
||||
// --> php_bz2_decompress_filter() does not detect errors,
|
||||
// --> fread() displays the empty string:
|
||||
$compressed = substr($compressed, 0, strlen($compressed) - 20);
|
||||
} else {
|
||||
// Corrupted final CRC
|
||||
// --> php_bz2_decompress_filter() detects fatal error
|
||||
// --> fread() displays an empty string, then the correct plain text, no error detected:
|
||||
$compressed[strlen($compressed)-2] = 'X';
|
||||
}
|
||||
|
||||
file_put_contents($fn, $compressed);
|
||||
|
||||
$r = fopen($fn, "r");
|
||||
stream_filter_append($r, 'bzip2.decompress', STREAM_FILTER_READ);
|
||||
while (!feof($r)) {
|
||||
$s = fread($r, 100);
|
||||
echo "read: "; var_dump($s);
|
||||
}
|
||||
fclose($r);
|
||||
unlink($fn);
|
||||
}
|
||||
|
||||
test(1);
|
||||
test(2);
|
||||
test(3);
|
||||
?>
|
||||
--EXPECT--
|
||||
Compressed len = 81
|
||||
read: bool(false)
|
||||
Compressed len = 81
|
||||
read: string(0) ""
|
||||
Compressed len = 81
|
||||
read: bool(false)
|
||||
+18
-10
@@ -133,7 +133,7 @@ struct php_bz2_stream_data_t {
|
||||
|
||||
/* {{{ BZip2 stream implementation */
|
||||
|
||||
static size_t php_bz2iop_read(php_stream *stream, char *buf, size_t count)
|
||||
static ssize_t php_bz2iop_read(php_stream *stream, char *buf, size_t count)
|
||||
{
|
||||
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
|
||||
size_t ret = 0;
|
||||
@@ -149,6 +149,9 @@ static size_t php_bz2iop_read(php_stream *stream, char *buf, size_t count)
|
||||
/* it is not safe to keep reading after an error, see #72613 */
|
||||
stream->eof = 1;
|
||||
if (just_read < 0) {
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
@@ -160,20 +163,24 @@ static size_t php_bz2iop_read(php_stream *stream, char *buf, size_t count)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static size_t php_bz2iop_write(php_stream *stream, const char *buf, size_t count)
|
||||
static ssize_t php_bz2iop_write(php_stream *stream, const char *buf, size_t count)
|
||||
{
|
||||
size_t wrote = 0;
|
||||
ssize_t wrote = 0;
|
||||
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
|
||||
|
||||
|
||||
do {
|
||||
int just_wrote;
|
||||
size_t remain = count - wrote;
|
||||
int to_write = (int)(remain <= INT_MAX ? remain : INT_MAX);
|
||||
|
||||
just_wrote = BZ2_bzwrite(self->bz_file, (char*)buf, to_write);
|
||||
|
||||
if (just_wrote < 1) {
|
||||
if (just_wrote < 0) {
|
||||
if (wrote == 0) {
|
||||
return just_wrote;
|
||||
}
|
||||
return wrote;
|
||||
}
|
||||
if (just_wrote == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -381,11 +388,12 @@ static PHP_FUNCTION(bzread)
|
||||
php_error_docref(NULL, E_WARNING, "length may not be negative");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
data = zend_string_alloc(len, 0);
|
||||
ZSTR_LEN(data) = php_stream_read(stream, ZSTR_VAL(data), ZSTR_LEN(data));
|
||||
ZSTR_VAL(data)[ZSTR_LEN(data)] = '\0';
|
||||
|
||||
RETURN_NEW_STR(data);
|
||||
data = php_stream_read_to_str(stream, len);
|
||||
if (!data) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_STR(data);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ array(2) {
|
||||
}
|
||||
string(2) "OK"
|
||||
int(0)
|
||||
string(0) ""
|
||||
bool(false)
|
||||
array(2) {
|
||||
["errno"]=>
|
||||
int(-5)
|
||||
@@ -69,7 +69,7 @@ array(2) {
|
||||
}
|
||||
string(16) "DATA_ERROR_MAGIC"
|
||||
int(-5)
|
||||
string(0) ""
|
||||
bool(false)
|
||||
array(2) {
|
||||
["errno"]=>
|
||||
int(-4)
|
||||
@@ -78,7 +78,7 @@ array(2) {
|
||||
}
|
||||
string(10) "DATA_ERROR"
|
||||
int(-4)
|
||||
string(0) ""
|
||||
bool(false)
|
||||
array(2) {
|
||||
["errno"]=>
|
||||
int(-5)
|
||||
@@ -87,7 +87,7 @@ array(2) {
|
||||
}
|
||||
string(16) "DATA_ERROR_MAGIC"
|
||||
int(-5)
|
||||
string(0) ""
|
||||
bool(false)
|
||||
array(2) {
|
||||
["errno"]=>
|
||||
int(-4)
|
||||
|
||||
@@ -21,7 +21,7 @@ $data = bzcompress($string);
|
||||
$data2 = bzcompress($string, 1, 10);
|
||||
|
||||
$data3 = $data2;
|
||||
$data3{3} = 0;
|
||||
$data3[3] = 0;
|
||||
|
||||
var_dump(bzdecompress());
|
||||
var_dump(bzdecompress(1,1,1));
|
||||
|
||||
@@ -20,4 +20,4 @@ bzclose($fp);
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
||||
ERROR: bzread()
|
||||
@@ -118,13 +118,13 @@ static HRESULT STDMETHODCALLTYPE stm_read(IStream *This, void *pv, ULONG cb, ULO
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE stm_write(IStream *This, void const *pv, ULONG cb, ULONG *pcbWritten)
|
||||
{
|
||||
ULONG nwrote;
|
||||
ssize_t nwrote;
|
||||
FETCH_STM();
|
||||
|
||||
nwrote = (ULONG)php_stream_write(stm->stream, pv, cb);
|
||||
nwrote = php_stream_write(stm->stream, pv, cb);
|
||||
|
||||
if (pcbWritten) {
|
||||
*pcbWritten = nwrote > 0 ? nwrote : 0;
|
||||
*pcbWritten = nwrote > 0 ? (ULONG)nwrote : 0;
|
||||
}
|
||||
if (nwrote > 0) {
|
||||
return S_OK;
|
||||
|
||||
Loaded 100 of 559 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user