mirror of
https://github.com/php/php-src.git
synced 2024-09-24 11:27:28 +00:00
Merge branch 'master' of git.php.net:php-src
This commit is contained in:
commit
d836e654bb
@ -655,7 +655,7 @@ static inline int getPixelOverflowTC(gdImagePtr im, const int x, const int y, co
|
||||
register int border;
|
||||
|
||||
if (y < im->cy1) {
|
||||
3 border = im->tpixels[0][im->cx1];
|
||||
border = im->tpixels[0][im->cx1];
|
||||
goto processborder;
|
||||
}
|
||||
|
||||
|
@ -972,7 +972,11 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
|
||||
zval result;
|
||||
|
||||
if (unary_op) {
|
||||
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
|
||||
unary_op(&result, &ZEND_OP1_LITERAL(opline));
|
||||
#else
|
||||
unary_op(&result, &ZEND_OP1_LITERAL(opline) TSRMLS_CC);
|
||||
#endif
|
||||
literal_dtor(&ZEND_OP1_LITERAL(opline));
|
||||
} else {
|
||||
/* BOOL */
|
||||
|
@ -203,7 +203,11 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
|
||||
|
||||
er = EG(error_reporting);
|
||||
EG(error_reporting) = 0;
|
||||
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
|
||||
if (unary_op(&result, &ZEND_OP1_LITERAL(opline)) != SUCCESS) {
|
||||
#else
|
||||
if (unary_op(&result, &ZEND_OP1_LITERAL(opline) TSRMLS_CC) != SUCCESS) {
|
||||
#endif
|
||||
EG(error_reporting) = er;
|
||||
break;
|
||||
}
|
||||
|
@ -134,6 +134,12 @@ static inline int is_stream_path(const char *filename)
|
||||
return ((*p == ':') && (p - filename > 1) && (p[1] == '/') && (p[2] == '/'));
|
||||
}
|
||||
|
||||
static inline int is_cachable_stream_path(const char *filename)
|
||||
{
|
||||
return memcmp(filename, "file://", sizeof("file://") - 1) == 0 ||
|
||||
memcmp(filename, "phar://", sizeof("phar://") - 1) == 0;
|
||||
}
|
||||
|
||||
/* O+ overrides PHP chdir() function and remembers the current working directory
|
||||
* in ZCG(cwd) and ZCG(cwd_len). Later accel_getcwd() can use stored value and
|
||||
* avoid getcwd() call.
|
||||
@ -1204,10 +1210,18 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han
|
||||
} else {
|
||||
*op_array_p = NULL;
|
||||
if (type == ZEND_REQUIRE) {
|
||||
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
|
||||
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
|
||||
#else
|
||||
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC);
|
||||
#endif
|
||||
zend_bailout();
|
||||
} else {
|
||||
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
|
||||
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
|
||||
#else
|
||||
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC);
|
||||
#endif
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -1365,7 +1379,9 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int
|
||||
!ZCG(enabled) || !accel_startup_ok ||
|
||||
(!ZCG(counted) && !ZCSG(accelerator_enabled)) ||
|
||||
CG(interactive) ||
|
||||
(ZCSG(restart_in_progress) && accel_restart_is_active(TSRMLS_C))) {
|
||||
(ZCSG(restart_in_progress) && accel_restart_is_active(TSRMLS_C)) ||
|
||||
(is_stream_path(file_handle->filename) &&
|
||||
!is_cachable_stream_path(file_handle->filename))) {
|
||||
/* The Accelerator is disabled, act as if without the Accelerator */
|
||||
return accelerator_orig_compile_file(file_handle, type TSRMLS_CC);
|
||||
}
|
||||
@ -1422,10 +1438,18 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int
|
||||
zend_stream_open(file_handle->filename, file_handle TSRMLS_CC) == FAILURE) {
|
||||
#endif
|
||||
if (type == ZEND_REQUIRE) {
|
||||
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
|
||||
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
|
||||
#else
|
||||
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC);
|
||||
#endif
|
||||
zend_bailout();
|
||||
} else {
|
||||
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
|
||||
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
|
||||
#else
|
||||
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC);
|
||||
#endif
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -1542,7 +1566,11 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int
|
||||
zend_hash_quick_add(&EG(included_files), persistent_script->full_path, persistent_script->full_path_len + 1, persistent_script->hash_value, &dummy, sizeof(void *), NULL);
|
||||
}
|
||||
}
|
||||
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
|
||||
zend_file_handle_dtor(file_handle);
|
||||
#else
|
||||
zend_file_handle_dtor(file_handle TSRMLS_CC);
|
||||
#endif
|
||||
from_shared_memory = 1;
|
||||
}
|
||||
|
||||
@ -2342,7 +2370,8 @@ static void zend_accel_init_shm(TSRMLS_D)
|
||||
ZCSG(manual_restarts) = 0;
|
||||
|
||||
ZCSG(accelerator_enabled) = 1;
|
||||
ZCSG(last_restart_time) = zend_accel_get_time();
|
||||
ZCSG(start_time) = zend_accel_get_time();
|
||||
ZCSG(last_restart_time) = 0;
|
||||
ZCSG(restart_in_progress) = 0;
|
||||
|
||||
zend_shared_alloc_unlock(TSRMLS_C);
|
||||
|
@ -27,7 +27,7 @@
|
||||
#endif
|
||||
|
||||
#define ACCELERATOR_PRODUCT_NAME "Zend OPcache"
|
||||
#define ACCELERATOR_VERSION "7.0.1-dev"
|
||||
#define ACCELERATOR_VERSION "7.0.1"
|
||||
/* 2 - added Profiler support, on 20010712 */
|
||||
/* 3 - added support for Optimizer's encoded-only-files mode */
|
||||
/* 4 - works with the new Optimizer, that supports the file format with licenses */
|
||||
@ -88,6 +88,7 @@
|
||||
#define PHP_5_2_X_API_NO 220060519
|
||||
#define PHP_5_3_X_API_NO 220090626
|
||||
#define PHP_5_4_X_API_NO 220100525
|
||||
#define PHP_5_5_X_API_NO 220121212
|
||||
|
||||
/*** file locking ***/
|
||||
#ifndef ZEND_WIN32
|
||||
@ -274,6 +275,7 @@ typedef struct _zend_accel_shared_globals {
|
||||
zend_accel_hash include_paths; /* used "include_path" values */
|
||||
|
||||
/* Directives & Maintenance */
|
||||
time_t start_time;
|
||||
time_t last_restart_time;
|
||||
time_t force_restart_time;
|
||||
zend_bool accelerator_enabled;
|
||||
|
@ -326,6 +326,39 @@ int main() {
|
||||
msg=yes,msg=no,msg=no)
|
||||
AC_MSG_RESULT([$msg])
|
||||
|
||||
AC_MSG_CHECKING(for known struct flock definition)
|
||||
dnl Copied from ZendAccelerator.h
|
||||
AC_TRY_RUN([
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef ZEND_WIN32
|
||||
extern int lock_file;
|
||||
|
||||
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (defined(__APPLE__) && defined(__MACH__)/* Darwin */) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
||||
struct flock name = {start, len, -1, type, whence}
|
||||
# elif defined(__svr4__)
|
||||
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
||||
struct flock name = {type, whence, start, len}
|
||||
# elif defined(__linux__) || defined(__hpux)
|
||||
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
||||
struct flock name = {type, whence, start, len, 0}
|
||||
# elif defined(_AIX)
|
||||
# if defined(_LARGE_FILES) || defined(__64BIT__)
|
||||
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
||||
struct flock name = {type, whence, 0, 0, 0, start, len }
|
||||
# else
|
||||
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
||||
struct flock name = {type, whence, start, len}
|
||||
# endif
|
||||
# else
|
||||
# error "Don't know how to define struct flock"
|
||||
# endif
|
||||
#endif
|
||||
int main() { return 0; }
|
||||
], [], [AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no])], [])
|
||||
|
||||
PHP_NEW_EXTENSION(opcache,
|
||||
ZendAccelerator.c \
|
||||
zend_accelerator_blacklist.c \
|
||||
|
2
ext/opcache/tests/bug64482.inc
Normal file
2
ext/opcache/tests/bug64482.inc
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
echo "Dynamic include";
|
17
ext/opcache/tests/bug64482.phpt
Normal file
17
ext/opcache/tests/bug64482.phpt
Normal file
@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #64482 (Opcodes for dynamic includes should not be cached)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'bug64482.inc';
|
||||
echo "\n";
|
||||
include 'php://filter/read=string.toupper/resource=bug64482.inc';
|
||||
echo "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Dynamic include
|
||||
DYNAMIC INCLUDE
|
@ -503,6 +503,7 @@ static ZEND_FUNCTION(opcache_get_status)
|
||||
add_assoc_long(statistics, "num_cached_keys", ZCSG(hash).num_entries);
|
||||
add_assoc_long(statistics, "max_cached_keys", ZCSG(hash).max_num_entries);
|
||||
add_assoc_long(statistics, "hits", ZCSG(hits));
|
||||
add_assoc_long(statistics, "start_time", ZCSG(start_time));
|
||||
add_assoc_long(statistics, "last_restart_time", ZCSG(last_restart_time));
|
||||
add_assoc_long(statistics, "oom_restarts", ZCSG(oom_restarts));
|
||||
add_assoc_long(statistics, "wasted_restarts", ZCSG(wasted_restarts));
|
||||
|
@ -857,7 +857,7 @@ static void zend_do_delayed_early_binding(zend_op_array *op_array, zend_uint ear
|
||||
}
|
||||
opline_num = op_array->opcodes[opline_num].result.u.opline_num;
|
||||
}
|
||||
zend_restore_compiled_filename(orig_compiled_filename);
|
||||
zend_restore_compiled_filename(orig_compiled_filename TSRMLS_CC);
|
||||
CG(in_compilation) = orig_in_compilation;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user