Merge remote-tracking branch 'origin/master' into native-tls

* origin/master: (102 commits)
  fix dir separator in test
  fix TS build
  fix TS build
  Better fix for bug #68446
  Revert "Merge remote-tracking branch 'origin/PHP-5.6'"
  Revert NEWS and set test to XFAIL
  Revert "Fix bug #68446 (bug with constant defaults and type hints)"
  Improved zend_hash_clean() and added new optimized zend_symtable_clean()
  Use inline version of zval_ptr_dtor()
  Added new optimized zend_array_destroy() function
  Moved i_zval_ptr_dtor() from zend_execute.h to zend_variables.h
  fix REGISTER_NS_*_CONSTANT macros
  Removed useless assert. EG(uninitialized_zval) can't be refcounted.
  Use specialized destructors when types of zvals are known.
  move tests into proper place
  Improved assignment to object property
  Reuse zend_assign_to_variable() in zend_std_write_property()
  cleanup comments from svn/cvs era
  fix dir separator in test
  fork test for windows
  ...
This commit is contained in:
Anatol Belski 2014-11-26 08:17:35 +01:00
commit 3ca0ca1548
203 changed files with 3234 additions and 853 deletions

View File

@ -42,7 +42,7 @@ Exceptions:
4. When writing functions that deal with strings, be sure to remember
that PHP holds the length property of each string, and that it
shouldn't be calculated with strlen(). Write your functions in a such
shouldn't be calculated with strlen(). Write your functions in such
a way so that they'll take advantage of the length property, both
for efficiency and in order for them to be binary-safe.
Functions that change strings and obtain their new lengths while

View File

@ -155,7 +155,7 @@ Table of Contents
a list of all available options along with short explanations running
./configure --help. Our manual documents the different options
separately. You will find the core options in the appendix, while the
different extension specific options are descibed on the reference
different extension specific options are described on the reference
pages.
When PHP is configured, you are ready to build the module and/or

8
NEWS
View File

@ -17,7 +17,10 @@ PHP NEWS
. Implemented FR #38409 (parse_ini_file() looses the type of booleans). (Tjerk)
. Fixed #67959 (Segfault when calling phpversion('spl')). (Florian)
. Implemented the RFC `Catchable "Call to a member function bar() on a
non-object"` (Timm)
non-object"`. (Timm)
. Added options parameter for unserialize allowing to specify acceptable
classes (https://wiki.php.net/rfc/secure_unserialize). (Stas)
. Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly triggered). (Julien)
- DBA:
. Fixed bug #62490 (dba_delete returns true on missing item (inifile)). (Mike)
@ -34,6 +37,9 @@ PHP NEWS
- FPM:
. Fixed bug #65933 (Cannot specify config lines longer than 1024 bytes). (Chris Wright)
- LiteSpeed:
. Updated LiteSpeed SAPI code from V5.5 to V6.6. (George Wang)
- Reflection
. Fixed inheritance chain of Reflector interface (Tjerk)

View File

@ -8,7 +8,7 @@ the original run-tests.php script. server-tests is *not* used by
'make test'. server-tests was developed to provide support for
testing PHP under it's primary environment, HTTP, and can run the
PHP tests under any of the SAPI modules that are direct executables,
or are accessable via HTTP.
or are accessible via HTTP.
[New features]
----------------
@ -95,7 +95,7 @@ include:
$filename full native path to file, will become PATH_TRANSLATED
$filepath =dirname($filename)
$scriptname this is what will become SCRIPT_NAME unless you override it
$docroot the equivelant of DOCUMENT_ROOT under Apache
$docroot the equivalent of DOCUMENT_ROOT under Apache
$cwd the directory that the test is being initiated from
$this->conf all server-tests configuration vars
$this->env all environment variables that will get passed to the test
@ -105,7 +105,7 @@ include:
This section is also eval'd, and is similar in nature to --ENV--. However,
this section is used to build the url used in an HTTP request. Valid values
to set in this section would include:
SCRIPT_NAME The inital part of the request url
SCRIPT_NAME The initial part of the request url
PATH_INFO The pathinfo part of a request url
FRAGMENT The fragment section of a url (after #)
QUERY_STRING The query part of a url (after ?)

View File

@ -63,6 +63,7 @@ PHP X.Y UPGRADE NOTES
- FPM
. Fixed bug #65933 (Cannot specify config lines longer than 1024 bytes).
. Listen = port now listen on all addresses (IPv6 and IPv4-mapped).
========================================
4. Deprecated Functionality
@ -76,6 +77,11 @@ PHP X.Y UPGRADE NOTES
- parse_ini_file():
- parse_ini_string():
Added scanner mode INI_SCANNER_TYPED to yield typed .ini values.
- unserialize():
Added second parameter for unserialize function
(RFC: https://wiki.php.net/rfc/secure_unserialize) allowing to specify
acceptable classes:
unserialize($foo, ["allowed_classes" => ["MyClass", "MyClass2"]);
========================================

36
Zend/tests/bug68446.phpt Normal file
View File

@ -0,0 +1,36 @@
--TEST--
Bug #68446 (Array constant not accepted for array parameter default)
--FILE--
<?php
const FOO = [1];
const BAR = null;
function a(array $a = FOO) {
var_dump($a);
}
function b(array $b = BAR) {
var_dump($b);
}
b(null);
b([]);
b();
a([]);
a();
a(null);
?>
--EXPECTF--
NULL
array(0) {
}
NULL
array(0) {
}
array(1) {
[0]=>
int(1)
}
Catchable fatal error: Argument 1 passed to a() must be of the type array, null given, called in %s on line %d and defined in %s on line %d

View File

@ -3834,8 +3834,7 @@ void zend_compile_params(zend_ast *ast TSRMLS_DC) /* {{{ */
zend_bool has_null_default = default_ast
&& (Z_TYPE(default_node.u.constant) == IS_NULL
|| (Z_TYPE(default_node.u.constant) == IS_CONSTANT
&& strcasecmp(Z_STRVAL(default_node.u.constant), "NULL") == 0)
|| Z_TYPE(default_node.u.constant) == IS_CONSTANT_AST); // ???
&& strcasecmp(Z_STRVAL(default_node.u.constant), "NULL") == 0));
op_array->fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;
arg_info->allow_null = has_null_default;
@ -3845,12 +3844,13 @@ void zend_compile_params(zend_ast *ast TSRMLS_DC) /* {{{ */
if (arg_info->type_hint == IS_ARRAY) {
if (default_ast && !has_null_default
&& Z_TYPE(default_node.u.constant) != IS_ARRAY
&& !Z_CONSTANT(default_node.u.constant)
) {
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
"with array type hint can only be an array or NULL");
}
} else if (arg_info->type_hint == IS_CALLABLE && default_ast) {
if (!has_null_default) {
if (!has_null_default && !Z_CONSTANT(default_node.u.constant)) {
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
"with callable type hint can only be NULL");
}
@ -3870,7 +3870,7 @@ void zend_compile_params(zend_ast *ast TSRMLS_DC) /* {{{ */
zend_string_release(class_name);
if (default_ast && !has_null_default) {
if (default_ast && !has_null_default && !Z_CONSTANT(default_node.u.constant)) {
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
"with a class type hint can only be NULL");
}

View File

@ -44,12 +44,12 @@ typedef struct _zend_constant {
#define REGISTER_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name)-1, (str), (flags), module_number TSRMLS_CC)
#define REGISTER_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name)-1, (str), (len), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_NULL_CONSTANT(ns, name, flags) zend_register_null_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_BOOL_CONSTANT(ns, name, bval, flags) zend_register_bool_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (bval), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (lval), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_DOUBLE_CONSTANT(ns, name, dval, flags) zend_register_double_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (dval), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_STRING_CONSTANT(ns, name, str, flags) zend_register_string_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_STRINGL_CONSTANT(ns, name, str, len, flags) zend_register_stringl_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (len), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_NULL_CONSTANT(ns, name, flags) zend_register_null_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (flags), module_number TSRMLS_CC)
#define REGISTER_NS_BOOL_CONSTANT(ns, name, bval, flags) zend_register_bool_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (bval), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_DOUBLE_CONSTANT(ns, name, dval, flags) zend_register_double_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (dval), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_STRING_CONSTANT(ns, name, str, flags) zend_register_string_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (str), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_STRINGL_CONSTANT(ns, name, str, len, flags) zend_register_stringl_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (str), (len), (flags), module_number TSRMLS_CC)
#define REGISTER_MAIN_NULL_CONSTANT(name, flags) zend_register_null_constant((name), sizeof(name)-1, (flags), 0 TSRMLS_CC)
#define REGISTER_MAIN_BOOL_CONSTANT(name, bval, flags) zend_register_bool_constant((name), sizeof(name)-1, (bval), (flags), 0 TSRMLS_CC)

View File

@ -574,7 +574,22 @@ ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, uin
}
}
static void zend_verify_arg_type(zend_function *zf, uint32_t arg_num, zval *arg TSRMLS_DC)
static int is_null_constant(zval *default_value TSRMLS_DC)
{
if (Z_CONSTANT_P(default_value)) {
zval constant;
ZVAL_COPY_VALUE(&constant, default_value);
zval_update_constant(&constant, 0 TSRMLS_CC);
if (Z_TYPE(constant) == IS_NULL) {
return 1;
}
zval_dtor(&constant);
}
return 0;
}
static void zend_verify_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, zval *default_value TSRMLS_DC)
{
zend_arg_info *cur_arg_info;
char *need_msg;
@ -601,18 +616,18 @@ static void zend_verify_arg_type(zend_function *zf, uint32_t arg_num, zval *arg
if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name->val, arg TSRMLS_CC);
}
} else if (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null) {
} else if (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC)))) {
need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce TSRMLS_CC);
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "", arg TSRMLS_CC);
}
} else if (cur_arg_info->type_hint) {
if (cur_arg_info->type_hint == IS_ARRAY) {
ZVAL_DEREF(arg);
if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC))))) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "", arg TSRMLS_CC);
}
} else if (cur_arg_info->type_hint == IS_CALLABLE) {
if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC))))) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "", arg TSRMLS_CC);
}
#if ZEND_DEBUG
@ -682,7 +697,7 @@ static void zend_verify_missing_arg(zend_execute_data *execute_data, uint32_t ar
static zend_always_inline void zend_assign_to_object(zval *retval, zval *object, uint32_t object_op_type, zval *property_name, int value_type, const znode_op *value_op, const zend_execute_data *execute_data, int opcode, void **cache_slot TSRMLS_DC)
{
zend_free_op free_value;
zval *value = get_zval_ptr(value_type, value_op, execute_data, &free_value, BP_VAR_R);
zval *value = get_zval_ptr_deref(value_type, value_op, execute_data, &free_value, BP_VAR_R);
zval tmp;
if (object_op_type != IS_UNUSED) {
@ -726,38 +741,101 @@ static zend_always_inline void zend_assign_to_object(zval *retval, zval *object,
}
}
/* separate our value if necessary */
if (value_type == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&tmp, value);
value = &tmp;
} else if (value_type == IS_CONST) {
if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
ZVAL_COPY_VALUE(&tmp, value);
zval_copy_ctor_func(&tmp);
value = &tmp;
}
} else if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
if (opcode == ZEND_ASSIGN_OBJ) {
if (!Z_OBJ_HT_P(object)->write_property) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (retval) {
ZVAL_NULL(retval);
}
if (value_type == IS_CONST) {
zval_ptr_dtor(value);
}
FREE_OP(free_value);
return;
}
if (cache_slot &&
EXPECTED(Z_OBJCE_P(object) == CACHED_PTR_EX(cache_slot))) {
zend_property_info *prop_info = CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
zval *property;
if (EXPECTED(prop_info)) {
property = OBJ_PROP(zobj, prop_info->offset);
if (Z_TYPE_P(property) != IS_UNDEF) {
fast_assign:
value = zend_assign_to_variable(property, value, value_type TSRMLS_CC);
if (retval && !EG(exception)) {
ZVAL_COPY(retval, value);
}
if (value_type == IS_VAR) {
FREE_OP(free_value);
}
return;
}
} else {
if (EXPECTED(zobj->properties != NULL)) {
property = zend_hash_find(zobj->properties, Z_STR_P(property_name));
if (property) {
goto fast_assign;
}
}
if (!zobj->ce->__set) {
if (EXPECTED(zobj->properties == NULL)) {
rebuild_object_properties(zobj);
}
/* separate our value if necessary */
if (value_type == IS_CONST) {
if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
ZVAL_COPY_VALUE(&tmp, value);
zval_copy_ctor_func(&tmp);
value = &tmp;
}
} else if (value_type != IS_TMP_VAR &&
Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
zend_hash_add_new(zobj->properties, Z_STR_P(property_name), value);
if (retval && !EG(exception)) {
ZVAL_COPY(retval, value);
}
if (value_type == IS_VAR) {
FREE_OP(free_value);
}
return;
}
}
}
/* separate our value if necessary */
if (value_type == IS_CONST) {
if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
ZVAL_COPY_VALUE(&tmp, value);
zval_copy_ctor_func(&tmp);
value = &tmp;
}
} else if (value_type != IS_TMP_VAR &&
Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
Z_OBJ_HT_P(object)->write_property(object, property_name, value, cache_slot TSRMLS_CC);
} else {
/* Note: property_name in this case is really the array index! */
if (!Z_OBJ_HT_P(object)->write_dimension) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
/* separate our value if necessary */
if (value_type == IS_CONST) {
if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
ZVAL_COPY_VALUE(&tmp, value);
zval_copy_ctor_func(&tmp);
value = &tmp;
}
} else if (value_type != IS_TMP_VAR &&
Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
Z_OBJ_HT_P(object)->write_dimension(object, property_name, value TSRMLS_CC);
}
@ -820,65 +898,6 @@ static void zend_assign_to_string_offset(zval *str, zend_long offset, zval *valu
}
}
static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, zend_uchar value_type TSRMLS_DC)
{
do {
if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) {
zend_refcounted *garbage;
if (Z_ISREF_P(variable_ptr)) {
variable_ptr = Z_REFVAL_P(variable_ptr);
if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
break;
}
}
if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value TSRMLS_CC);
return variable_ptr;
}
if ((value_type & (IS_VAR|IS_CV)) && variable_ptr == value) {
return variable_ptr;
}
garbage = Z_COUNTED_P(variable_ptr);
if (--GC_REFCOUNT(garbage) == 0) {
ZVAL_COPY_VALUE(variable_ptr, value);
if (value_type == IS_CONST) {
/* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
if (UNEXPECTED(Z_OPT_COPYABLE_P(variable_ptr))) {
zval_copy_ctor_func(variable_ptr);
}
} else if (value_type != IS_TMP_VAR) {
if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
Z_ADDREF_P(variable_ptr);
}
}
_zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
return variable_ptr;
} else { /* we need to split */
/* optimized version of GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr) */
if ((Z_COLLECTABLE_P(variable_ptr)) &&
UNEXPECTED(!GC_INFO(garbage))) {
gc_possible_root(garbage TSRMLS_CC);
}
}
}
} while (0);
ZVAL_COPY_VALUE(variable_ptr, value);
if (value_type == IS_CONST) {
/* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
if (UNEXPECTED(Z_OPT_COPYABLE_P(variable_ptr))) {
zval_copy_ctor_func(variable_ptr);
}
} else if (value_type != IS_TMP_VAR) {
if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
Z_ADDREF_P(variable_ptr);
}
}
return variable_ptr;
}
/* Utility Functions for Extensions */
static void zend_extension_statement_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
{
@ -1407,12 +1426,12 @@ ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_val
ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table TSRMLS_DC) /* {{{ */
{
if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) {
zend_hash_destroy(&symbol_table->ht);
zend_array_destroy(&symbol_table->ht TSRMLS_CC);
efree_size(symbol_table, sizeof(zend_array));
} else {
/* clean before putting into the cache, since clean
could call dtors, which could use cached hash */
zend_hash_clean(&symbol_table->ht);
zend_symtable_clean(&symbol_table->ht TSRMLS_CC);
*(++EG(symtable_cache_ptr)) = symbol_table;
}
}

View File

@ -51,18 +51,6 @@ ZEND_API int zend_eval_stringl_ex(char *str, size_t str_len, zval *retval_ptr, c
ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, char **class_name, zend_class_entry **pce TSRMLS_DC);
ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, uint32_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg TSRMLS_DC);
static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC TSRMLS_DC)
{
if (Z_REFCOUNTED_P(zval_ptr)) {
if (!Z_DELREF_P(zval_ptr)) {
ZEND_ASSERT(zval_ptr != &EG(uninitialized_zval));
_zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_RELAY_CC);
} else {
GC_ZVAL_CHECK_POSSIBLE_ROOT(zval_ptr);
}
}
}
static zend_always_inline int i_zend_is_true(zval *op TSRMLS_DC)
{
int result;
@ -129,6 +117,65 @@ again:
return result;
}
static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, zend_uchar value_type TSRMLS_DC)
{
do {
if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) {
zend_refcounted *garbage;
if (Z_ISREF_P(variable_ptr)) {
variable_ptr = Z_REFVAL_P(variable_ptr);
if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
break;
}
}
if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value TSRMLS_CC);
return variable_ptr;
}
if ((value_type & (IS_VAR|IS_CV)) && variable_ptr == value) {
return variable_ptr;
}
garbage = Z_COUNTED_P(variable_ptr);
if (--GC_REFCOUNT(garbage) == 0) {
ZVAL_COPY_VALUE(variable_ptr, value);
if (value_type == IS_CONST) {
/* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
if (UNEXPECTED(Z_OPT_COPYABLE_P(variable_ptr))) {
zval_copy_ctor_func(variable_ptr);
}
} else if (value_type != IS_TMP_VAR) {
if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
Z_ADDREF_P(variable_ptr);
}
}
_zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
return variable_ptr;
} else { /* we need to split */
/* optimized version of GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr) */
if ((Z_COLLECTABLE_P(variable_ptr)) &&
UNEXPECTED(!GC_INFO(garbage))) {
gc_possible_root(garbage TSRMLS_CC);
}
}
}
} while (0);
ZVAL_COPY_VALUE(variable_ptr, value);
if (value_type == IS_CONST) {
/* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
if (UNEXPECTED(Z_OPT_COPYABLE_P(variable_ptr))) {
zval_copy_ctor_func(variable_ptr);
}
} else if (value_type != IS_TMP_VAR) {
if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
Z_ADDREF_P(variable_ptr);
}
}
return variable_ptr;
}
ZEND_API int zval_update_constant(zval *pp, zend_bool inline_change TSRMLS_DC);
ZEND_API int zval_update_constant_inline_change(zval *pp, zend_class_entry *scope TSRMLS_DC);
ZEND_API int zval_update_constant_no_inline_change(zval *pp, zend_class_entry *scope TSRMLS_DC);

View File

@ -21,6 +21,8 @@
#ifndef ZEND_FLOAT_H
#define ZEND_FLOAT_H
BEGIN_EXTERN_C()
/*
Define functions for FP initialization and de-initialization.
*/
@ -28,6 +30,8 @@ extern ZEND_API void zend_init_fpu(TSRMLS_D);
extern ZEND_API void zend_shutdown_fpu(TSRMLS_D);
extern ZEND_API void zend_ensure_fpu_mode(TSRMLS_D);
END_EXTERN_C()
/* Copy of the contents of xpfpa.h (which is under public domain)
See http://wiki.php.net/rfc/rounding for details.

View File

@ -21,6 +21,7 @@
#include "zend.h"
#include "zend_globals.h"
#include "zend_variables.h"
#if ZEND_DEBUG
/*
@ -944,24 +945,115 @@ ZEND_API void zend_hash_destroy(HashTable *ht)
pefree(ht->arData, ht->u.flags & HASH_FLAG_PERSISTENT);
}
ZEND_API void zend_hash_clean(HashTable *ht)
ZEND_API void zend_array_destroy(HashTable *ht TSRMLS_DC)
{
uint32_t idx;
Bucket *p;
Bucket *p, *end;
IS_CONSISTENT(ht);
for (idx = 0; idx < ht->nNumUsed; idx++) {
p = ht->arData + idx;
if (Z_TYPE(p->val) == IS_UNDEF) continue;
if (ht->nNumUsed) {
/* In some rare cases destructors of regular arrays may be changed */
if (UNEXPECTED(ht->pDestructor != ZVAL_PTR_DTOR)) {
zend_hash_destroy(ht);
return;
}
p = ht->arData;
end = p + ht->nNumUsed;
SET_INCONSISTENT(HT_IS_DESTROYING);
if (ht->u.flags & HASH_FLAG_PACKED) {
do {
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC TSRMLS_CC);
}
} while (++p != end);
} else {
do {
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC TSRMLS_CC);
if (EXPECTED(p->key)) {
zend_string_release(p->key);
}
}
} while (++p != end);
}
SET_INCONSISTENT(HT_DESTROYED);
} else if (EXPECTED(!ht->nTableMask)) {
return;
}
pefree(ht->arData, ht->u.flags & HASH_FLAG_PERSISTENT);
}
ZEND_API void zend_hash_clean(HashTable *ht)
{
Bucket *p, *end;
IS_CONSISTENT(ht);
if (ht->nNumUsed) {
p = ht->arData;
end = p + ht->nNumUsed;
if (ht->pDestructor) {
ht->pDestructor(&p->val);
if (ht->u.flags & HASH_FLAG_PACKED) {
do {
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
ht->pDestructor(&p->val);
}
} while (++p != end);
} else {
do {
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
ht->pDestructor(&p->val);
if (EXPECTED(p->key)) {
zend_string_release(p->key);
}
}
} while (++p != end);
}
} else {
if (!(ht->u.flags & HASH_FLAG_PACKED)) {
do {
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
if (EXPECTED(p->key)) {
zend_string_release(p->key);
}
}
} while (++p != end);
}
}
if (p->key) {
zend_string_release(p->key);
}
ht->nNumUsed = 0;
ht->nNumOfElements = 0;
ht->nNextFreeElement = 0;
ht->nInternalPointer = INVALID_IDX;
if (ht->nTableMask) {
if (!(ht->u.flags & HASH_FLAG_PACKED)) {
memset(ht->arHash, INVALID_IDX, ht->nTableSize * sizeof(uint32_t));
}
}
}
ZEND_API void zend_symtable_clean(HashTable *ht TSRMLS_DC)
{
Bucket *p, *end;
IS_CONSISTENT(ht);
if (ht->nNumUsed) {
p = ht->arData;
end = p + ht->nNumUsed;
do {
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC TSRMLS_CC);
if (EXPECTED(p->key)) {
zend_string_release(p->key);
}
}
} while (++p != end);
}
ht->nNumUsed = 0;
ht->nNumOfElements = 0;
ht->nNextFreeElement = 0;

View File

@ -216,6 +216,8 @@ ZEND_API zval *zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint
ZEND_API int zend_hash_rehash(HashTable *ht);
ZEND_API void zend_array_dup(HashTable *target, HashTable *source);
ZEND_API void zend_array_destroy(HashTable *ht TSRMLS_DC);
ZEND_API void zend_symtable_clean(HashTable *ht TSRMLS_DC);
#if ZEND_DEBUG
/* debug */

View File

@ -1238,7 +1238,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
/* make sure that the trait method is not from a class mentioned in
exclude_from_classes, for consistency */
if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[i].ce) {
if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[j].ce) {
zend_error_noreturn(E_COMPILE_ERROR,
"Inconsistent insteadof definition. "
"The method %s is to be used from %s, but %s is also on the exclude list",

View File

@ -545,51 +545,7 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, v
} else if (EXPECTED(zobj->properties != NULL)) {
if ((variable_ptr = zend_hash_find(zobj->properties, Z_STR_P(member))) != NULL) {
found:
/* if we already have this value there, we don't actually need to do anything */
if (EXPECTED(variable_ptr != value)) {
/* if we are assigning reference, we shouldn't move it, but instead assign variable
to the same pointer */
if (Z_ISREF_P(variable_ptr)) {
zval garbage;
ZVAL_COPY_VALUE(&garbage, Z_REFVAL_P(variable_ptr)); /* old value should be destroyed */
/* To check: can't *variable_ptr be some system variable like error_zval here? */
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
if (EXPECTED(!Z_ISREF_P(value))) {
Z_ADDREF_P(value);
} else {
if (Z_REFCOUNT_P(value) == 1) {
ZVAL_UNREF(value);
} else {
value = Z_REFVAL_P(value);
}
if (Z_REFCOUNTED_P(value)) {
if (UNEXPECTED(Z_REFVAL_P(variable_ptr) == value)) {
goto exit;
}
Z_ADDREF_P(value);
}
}
}
ZVAL_COPY_VALUE(Z_REFVAL_P(variable_ptr), value);
zval_ptr_dtor(&garbage);
} else {
zval garbage;
ZVAL_COPY_VALUE(&garbage, variable_ptr);
/* if we assign referenced variable, we should separate it */
ZVAL_COPY_VALUE(variable_ptr, value);
if (Z_REFCOUNTED_P(variable_ptr)) {
Z_ADDREF_P(variable_ptr);
if (Z_ISREF_P(variable_ptr)) {
SEPARATE_ZVAL(variable_ptr);
}
}
zval_ptr_dtor(&garbage);
}
}
zend_assign_to_variable(variable_ptr, value, (IS_VAR|IS_TMP_VAR) TSRMLS_CC);
goto exit;
}
}

View File

@ -47,18 +47,19 @@ ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSR
ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC)
{
int i;
int i, count;
if (object->guards) {
zend_hash_destroy(object->guards);
FREE_HASHTABLE(object->guards);
}
if (object->properties) {
zend_hash_destroy(object->properties);
zend_array_destroy(object->properties TSRMLS_CC);
FREE_HASHTABLE(object->properties);
}
for (i = 0; i < object->ce->default_properties_count; i++) {
zval_ptr_dtor(&object->properties_table[i]);
count = object->ce->default_properties_count;
for (i = 0; i < count; i++) {
i_zval_ptr_dtor(&object->properties_table[i] ZEND_FILE_LINE_CC TSRMLS_CC);
}
}

View File

@ -45,7 +45,7 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
/* break possible cycles */
GC_TYPE(arr) = IS_NULL;
GC_REMOVE_FROM_BUFFER(arr);
zend_hash_destroy(&arr->ht);
zend_array_destroy(&arr->ht TSRMLS_CC);
efree_size(arr, sizeof(zend_array));
}
break;
@ -77,7 +77,9 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
case IS_REFERENCE: {
zend_reference *ref = (zend_reference*)p;
if (--GC_REFCOUNT(ref) == 0) {
zval_ptr_dtor(&ref->val);
TSRMLS_FETCH();
i_zval_ptr_dtor(&ref->val ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
efree_size(ref, sizeof(zend_reference));
}
break;
@ -105,7 +107,7 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
/* break possible cycles */
GC_TYPE(arr) = IS_NULL;
GC_REMOVE_FROM_BUFFER(arr);
zend_hash_destroy(&arr->ht);
zend_array_destroy(&arr->ht TSRMLS_CC);
efree_size(arr, sizeof(zend_array));
}
break;
@ -134,8 +136,9 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
}
case IS_REFERENCE: {
zend_reference *ref = (zend_reference*)p;
TSRMLS_FETCH();
zval_ptr_dtor(&ref->val);
i_zval_ptr_dtor(&ref->val ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
efree_size(ref, sizeof(zend_reference));
break;
}
@ -293,7 +296,9 @@ ZEND_API void _zval_internal_dtor_wrapper(zval *zvalue)
ZEND_API void _zval_ptr_dtor_wrapper(zval *zval_ptr)
{
zval_ptr_dtor(zval_ptr);
TSRMLS_FETCH();
i_zval_ptr_dtor(zval_ptr ZEND_FILE_LINE_CC TSRMLS_CC);
}

View File

@ -22,6 +22,8 @@
#ifndef ZEND_VARIABLES_H
#define ZEND_VARIABLES_H
#include "zend_types.h"
#include "zend_gc.h"
BEGIN_EXTERN_C()
@ -43,6 +45,17 @@ static zend_always_inline void _zval_ptr_dtor_nogc(zval *zval_ptr ZEND_FILE_LINE
}
}
static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC TSRMLS_DC)
{
if (Z_REFCOUNTED_P(zval_ptr)) {
if (!Z_DELREF_P(zval_ptr)) {
_zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_RELAY_CC);
} else {
GC_ZVAL_CHECK_POSSIBLE_ROOT(zval_ptr);
}
}
}
ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC);
#define zval_copy_ctor_func(zv) _zval_copy_ctor_func(zv ZEND_FILE_LINE_CC)

View File

@ -21,9 +21,13 @@
#ifndef ZEND_VM_H
#define ZEND_VM_H
BEGIN_EXTERN_C()
ZEND_API void zend_vm_use_old_executor(void);
ZEND_API void zend_vm_set_opcode_handler(zend_op* opcode);
END_EXTERN_C()
#define ZEND_VM_SET_OPCODE_HANDLER(opline) zend_vm_set_opcode_handler(opline)
#endif

View File

@ -385,7 +385,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
if (Z_REFCOUNT_P(z) == 0) {
zval_dtor(z);
zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
}
ZVAL_COPY_VALUE(z, value);
}
@ -711,7 +711,7 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|
zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
if (Z_REFCOUNT_P(z) == 0) {
zval_dtor(z);
zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
}
ZVAL_COPY_VALUE(z, value);
}
@ -798,7 +798,7 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR
zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
if (Z_REFCOUNT_P(z) == 0) {
zval_dtor(z);
zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
}
ZVAL_COPY_VALUE(z, value);
}
@ -2080,7 +2080,7 @@ ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|CV)
add_string_to_string(str, str, var);
if (use_copy) {
zval_dtor(var);
zend_string_release(Z_STR_P(var));
}
/* original comment, possibly problematic:
* FREE_OP is missing intentionally here - we're always working on the same temporary variable
@ -2675,7 +2675,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
zval *p = ZEND_CALL_ARG(call, 1);
for (i = 0; i < call->num_args; ++i) {
zend_verify_arg_type(fbc, i + 1, p TSRMLS_CC);
zend_verify_arg_type(fbc, i + 1, p, NULL TSRMLS_CC);
p++;
}
if (UNEXPECTED(EG(exception) != NULL)) {
@ -2980,9 +2980,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
}
exception = EG(exception);
if (Z_REFCOUNTED_P(EX_VAR(opline->op2.var))) {
zval_ptr_dtor(EX_VAR(opline->op2.var));
}
zval_ptr_dtor(EX_VAR(opline->op2.var));
ZVAL_OBJ(EX_VAR(opline->op2.var), EG(exception));
if (UNEXPECTED(EG(exception) != exception)) {
GC_REFCOUNT(EG(exception))++;
@ -3269,7 +3267,7 @@ ZEND_VM_C_LABEL(send_again):
if (Z_TYPE(key) == IS_STRING) {
zend_error(E_RECOVERABLE_ERROR,
"Cannot unpack Traversable with string keys");
zval_dtor(&key);
zend_string_release(Z_STR(key));
ZEND_VM_C_GOTO(unpack_iter_dtor);
}
@ -3528,7 +3526,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
} else if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
zval *param = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
zend_verify_arg_type(EX(func), arg_num, param TSRMLS_CC);
zend_verify_arg_type(EX(func), arg_num, param, NULL TSRMLS_CC);
CHECK_EXCEPTION();
}
@ -3556,7 +3554,7 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
}
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
zend_verify_arg_type(EX(func), arg_num, param TSRMLS_CC);
zend_verify_arg_type(EX(func), arg_num, param, opline->op2.zv TSRMLS_CC);
}
CHECK_EXCEPTION();
@ -3581,7 +3579,7 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, ANY, ANY)
param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
do {
zend_verify_arg_type(EX(func), arg_num, param TSRMLS_CC);
zend_verify_arg_type(EX(func), arg_num, param, NULL TSRMLS_CC);
zend_hash_next_index_insert_new(Z_ARRVAL_P(params), param);
if (Z_REFCOUNTED_P(param)) Z_ADDREF_P(param);
param++;
@ -3712,7 +3710,7 @@ ZEND_VM_HANDLER(68, ZEND_NEW, CONST|VAR, ANY)
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), &object_zval);
} else {
zval_ptr_dtor(&object_zval);
OBJ_RELEASE(Z_OBJ(object_zval));
}
ZEND_VM_JMP(opline->op2.jmp_addr);
} else {
@ -3790,7 +3788,7 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY)
if (EXPECTED(EG(exception) == NULL)) {
ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj TSRMLS_CC));
if (!RETURN_VALUE_USED(opline) || UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor(EX_VAR(opline->result.var));
OBJ_RELEASE(Z_OBJ_P(EX_VAR(opline->result.var)));
}
}
FREE_OP1_IF_VAR();
@ -4197,7 +4195,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
}
}
if (Z_TYPE(tmp_inc_filename) != IS_UNDEF) {
zval_ptr_dtor(&tmp_inc_filename);
zend_string_release(Z_STR(tmp_inc_filename));
}
FREE_OP1();
if (UNEXPECTED(EG(exception) != NULL)) {
@ -4288,8 +4286,8 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
} else {
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (OP1_TYPE != IS_CONST) {
zval_dtor(&tmp);
if (OP1_TYPE != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
zend_string_release(Z_STR(tmp));
}
FREE_OP1();
HANDLE_EXCEPTION();
@ -4308,8 +4306,8 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
}
if (OP1_TYPE != IS_CONST) {
zval_dtor(&tmp);
if (OP1_TYPE != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
zend_string_release(Z_STR(tmp));
}
FREE_OP1();
CHECK_EXCEPTION();
@ -4892,6 +4890,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
zend_free_op free_op1;
zval tmp, *varname = GET_OP1_ZVAL_PTR(BP_VAR_IS);
ZVAL_UNDEF(&tmp);
if (OP1_TYPE != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
@ -4920,8 +4919,8 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
}
if (OP1_TYPE != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
if (OP1_TYPE != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
zend_string_release(Z_STR(tmp));
}
FREE_OP1();
@ -5898,23 +5897,39 @@ ZEND_VM_HANDLER(168, ZEND_BIND_GLOBAL, CV, CONST)
zval *varname;
zval *value;
zval *variable_ptr;
Bucket *p;
uint32_t idx;
SAVE_OPLINE();
varname = GET_OP2_ZVAL_PTR(BP_VAR_R);
idx = (uint32_t)(uintptr_t)CACHED_PTR(Z_CACHE_SLOT_P(varname));
/* index 0 can't be cached (NULL is a mark of uninitialized cache slot) */
p = EG(symbol_table).ht.arData + idx;
if (EXPECTED(idx > 0) &&
EXPECTED(idx < EG(symbol_table).ht.nNumUsed) &&
EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
(EXPECTED(p->key == Z_STR_P(varname)) ||
(EXPECTED(p->h == Z_STR_P(varname)->h) &&
EXPECTED(p->key != NULL) &&
EXPECTED(p->key->len == Z_STRLEN_P(varname)) &&
EXPECTED(memcmp(p->key->val, Z_STRVAL_P(varname), Z_STRLEN_P(varname)) == 0)))) {
value = &EG(symbol_table).ht.arData[idx].val;
/* We store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
idx = (uint32_t)(uintptr_t)CACHED_PTR(Z_CACHE_SLOT_P(varname)) - 1;
if (EXPECTED(idx < EG(symbol_table).ht.nNumUsed)) {
Bucket *p = EG(symbol_table).ht.arData + idx;
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
(EXPECTED(p->key == Z_STR_P(varname)) ||
(EXPECTED(p->h == Z_STR_P(varname)->h) &&
EXPECTED(p->key != NULL) &&
EXPECTED(p->key->len == Z_STRLEN_P(varname)) &&
EXPECTED(memcmp(p->key->val, Z_STRVAL_P(varname), Z_STRLEN_P(varname)) == 0)))) {
value = &EG(symbol_table).ht.arData[idx].val;
ZEND_VM_C_GOTO(check_indirect);
}
}
value = zend_hash_find(&EG(symbol_table).ht, Z_STR_P(varname));
if (UNEXPECTED(value == NULL)) {
value = zend_hash_add_new(&EG(symbol_table).ht, Z_STR_P(varname), &EG(uninitialized_zval));
idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
/* Store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)(idx + 1));
} else {
idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
/* Store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)(idx + 1));
ZEND_VM_C_LABEL(check_indirect):
/* GLOBAL variable may be an INDIRECT pointer to CV */
if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
value = Z_INDIRECT_P(value);
@ -5922,23 +5937,6 @@ ZEND_VM_HANDLER(168, ZEND_BIND_GLOBAL, CV, CONST)
ZVAL_NULL(value);
}
}
} else {
value = zend_hash_find(&EG(symbol_table).ht, Z_STR_P(varname));
if (UNEXPECTED(value == NULL)) {
value = zend_hash_add_new(&EG(symbol_table).ht, Z_STR_P(varname), &EG(uninitialized_zval));
idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)idx);
} else {
idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)idx);
/* GLOBAL variable may be an INDIRECT pointer to CV */
if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
value = Z_INDIRECT_P(value);
if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
ZVAL_NULL(value);
}
}
}
}
variable_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);

File diff suppressed because it is too large Load Diff

View File

@ -1217,7 +1217,9 @@ function gen_vm($def, $skel) {
out($f, $GLOBALS['header_text']);
fputs($f, "#ifndef ZEND_VM_OPCODES_H\n#define ZEND_VM_OPCODES_H\n\n");
fputs($f, "BEGIN_EXTERN_C()\n\n");
fputs($f, "ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);\n\n");
fputs($f, "END_EXTERN_C()\n\n");
foreach ($opcodes as $code => $dsc) {
$code = str_pad((string)$code,$code_len," ",STR_PAD_LEFT);

View File

@ -21,8 +21,12 @@
#ifndef ZEND_VM_OPCODES_H
#define ZEND_VM_OPCODES_H
BEGIN_EXTERN_C()
ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);
END_EXTERN_C()
#define ZEND_NOP 0
#define ZEND_ADD 1
#define ZEND_SUB 2

View File

@ -47,7 +47,7 @@
*
* CALENDAR OVERVIEW
*
* Julias Ceasar created the calendar in 46 B.C. as a modified form of
* Julius Caesar created the calendar in 46 B.C. as a modified form of
* the old Roman republican calendar which was based on lunar cycles.
* The new Julian calendar set fixed lengths for the months, abandoning
* the lunar cycle. It also specified that there would be exactly 12

View File

@ -21,10 +21,10 @@ putenv('TZ=UTC');
// -uses --INI-- section with date.timezone=UTC
// -uses putenv('TZ=UTC')
// date.timezone=UTC
// -if ommitted from easter_date.phpt, outputs DATE_TZ_ERRMSG warning
// -if omitted from easter_date.phpt, outputs DATE_TZ_ERRMSG warning
// -easter_date() calls mktime() and localtime()
// -whereas unixtojd(1000000000) calls localtime(1000000000)
// -if ommitted from unixtojd.phpt, does NOT output DATE_TZ_ERRMSG
// -if omitted from unixtojd.phpt, does NOT output DATE_TZ_ERRMSG
//
// unixtojd() calls php_localtime_r() which for Pacific timezone systems, returns a time -8 hours
// -this incorrect localtime is passed to the julian date conversion (GregorianToSDN) function which works (probably correctly)

View File

@ -0,0 +1,27 @@
--TEST--
Test curl_multi_init() fail if any parameter is passed
--CREDITS--
Paulo Eduardo <pauloelr [at] gmail [dot] com>
#testfest SP 2014
--SKIPIF--
<?php if (!extension_loaded("curl")) print "skip"; ?>
--FILE--
<?php
/* Prototype : resource curl_multi_init(void)
* Description : Returns a new cURL multi handle
* Source code : ext/curl/multi.c
* Test documentation: http://wiki.php.net/qa/temp/ext/curl
*/
// start testing
//create the multiple cURL handle
$mh = curl_multi_init('test');
var_dump($mh);
?>
===DONE===
--EXPECTF--
Warning: curl_multi_init() expects exactly 0 parameters, %d given in %s on line %d
NULL
===DONE===

View File

@ -336,7 +336,7 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
{
uint32_t i;
/* If there is no transistion time, we pick the first one, if that doesn't
/* If there is no transition time, we pick the first one, if that doesn't
* exist we return NULL */
if (!tz->timecnt || !tz->trans) {
*transition_time = 0;
@ -346,8 +346,8 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
return NULL;
}
/* If the TS is lower than the first transistion time, then we scan over
* all the transistion times to find the first non-DST one, or the first
/* If the TS is lower than the first transition time, then we scan over
* all the transition times to find the first non-DST one, or the first
* one in case there are only DST entries. Not sure which smartass came up
* with this idea in the first though :) */
if (ts < tz->trans[0]) {

View File

@ -3,7 +3,7 @@ strtotime() function
--SKIPIF--
<?php
if (!@putenv("TZ=EST5") || getenv("TZ") != 'EST5') {
die("skip unable to change TZ enviroment variable\n");
die("skip unable to change TZ environment variable\n");
}
?>
--FILE--

View File

@ -8,7 +8,7 @@ if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
die("skip. set TZ env is not supported at runtime.");
}
if (!@putenv("TZ=US/Eastern") || getenv("TZ") != 'US/Eastern') {
die("skip unable to change TZ enviroment variable\n");
die("skip unable to change TZ environment variable\n");
}
?>
--FILE--

View File

@ -4,7 +4,7 @@ Bug #26317 (military timezone offset signedness)
date.timezone=GMT0
--SKIPIF--
if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
die("skip unable to change TZ enviroment variable\n");
die("skip unable to change TZ environment variable\n");
}
--FILE--
<?php

View File

@ -4,7 +4,7 @@ Bug #26320 (strtotime handling of XML Schema/ISO 8601 format)
date.timezone=GMT0
--SKIPIF--
if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
die("skip unable to change TZ enviroment variable\n");
die("skip unable to change TZ environment variable\n");
}
--FILE--
<?php

View File

@ -0,0 +1,34 @@
--TEST--
Test date_interval_create_from_date_string() function : basic functionality
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--FILE--
<?php
$string = '1 day'; //P1D
$i = date_interval_create_from_date_string($string);
var_dump($i->d);
$string = '2 weeks'; //14 days
$i = date_interval_create_from_date_string($string);
var_dump($i->d);
$string = '3 months';
$i = date_interval_create_from_date_string($string);
var_dump($i->m);
$string = '4 years';
$i = date_interval_create_from_date_string($string);
var_dump($i->y);
$string = '1 year + 1 day';
$i = date_interval_create_from_date_string($string);
var_dump($i->y);
var_dump($i->d);
?>
--EXPECTF--
int(1)
int(14)
int(3)
int(4)
int(1)
int(1)

View File

@ -0,0 +1,42 @@
--TEST--
Test date_interval_create_from_date_string() function : null parameter
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--FILE--
<?php
$i = date_interval_create_from_date_string(null); //returns a empty object
var_dump($i);
?>
--EXPECTF--
object(DateInterval)#1 (15) {
["y"]=>
int(0)
["m"]=>
int(0)
["d"]=>
int(0)
["h"]=>
int(0)
["i"]=>
int(0)
["s"]=>
int(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
int(0)
["first_last_day_of"]=>
int(0)
["invert"]=>
int(0)
["days"]=>
int(0)
["special_type"]=>
int(0)
["special_amount"]=>
int(0)
["have_weekday_relative"]=>
int(0)
["have_special_relative"]=>
int(0)
}

View File

@ -0,0 +1,11 @@
--TEST--
Test date_interval_create_from_date_string() function : wrong parameter (array)
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--FILE--
<?php
$wrong_parameter = array();
$i = date_interval_create_from_date_string($wrong_parameter);
?>
--EXPECTF--
Warning: date_interval_create_from_date_string() expects parameter 1 to be string, array given in %s on line %d

View File

@ -0,0 +1,9 @@
--TEST--
Test date_interval_create_from_date_string() function : with 2 parameters (wrong).
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--FILE--
<?php
$i = date_interval_create_from_date_string('1 year', 'wrong');
?>
--EXPECTF--
Warning: date_interval_create_from_date_string() expects exactly 1 parameter, 2 given in %s on line %d

View File

@ -0,0 +1,19 @@
--TEST--
Test the basics to function date_timestamp_set().
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--INI--
date.timezone = UTC;
date_default_timezone_set("America/Sao_Paulo");
--FILE--
<?php
$dftz021 = date_default_timezone_get(); //UTC
$dtms021 = date_create();
date_timestamp_set($dtms021, 1234567890);
var_dump(date_format($dtms021, 'B => (U) => T Y-M-d H:i:s'));
?>
--EXPECTF--
string(47) "021 => (1234567890) => UTC 2009-Feb-13 23:31:30"

View File

@ -0,0 +1,17 @@
--TEST--
Test the function date_timestamp_set() with first null parameter.
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--INI--
date.timezone = UTC;
date_default_timezone_set("America/Sao_Paulo");
--FILE--
<?php
$dftz021 = date_default_timezone_get(); //UTC
$dtms021 = date_create();
date_timestamp_set(null, 1234567890);
?>
--EXPECTF--
Warning: date_timestamp_set() expects parameter 1 to be DateTime, null given in %s on line %d

View File

@ -0,0 +1,24 @@
--TEST--
Test the function date_timestamp_set() with second null parameter.
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--INI--
date.timezone = UTC;
date_default_timezone_set("America/Sao_Paulo");
--FILE--
<?php
$dftz021 = date_default_timezone_get(); //UTC
$dtms021 = date_create();
var_dump(date_timestamp_set($dtms021, null));
?>
--EXPECTF--
object(DateTime)#1 (3) {
["date"]=>
string(26) "1970-01-01 00:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}

View File

@ -0,0 +1,17 @@
--TEST--
Check the function date_timestamp_set() with first parameter wrong (array).
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--INI--
date.timezone = UTC;
date_default_timezone_set("America/Sao_Paulo");
--FILE--
<?php
$dftz021 = date_default_timezone_get(); //UTC
$dtms021 = array();
date_timestamp_set($dtms021, 123456789);
?>
--EXPECTF--
Warning: date_timestamp_set() expects parameter 1 to be DateTime, array given in %s on line %d

View File

@ -0,0 +1,15 @@
--TEST--
Check the function date_timestamp_set() with first parameter wrong (integer).
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--INI--
date.timezone = UTC;
date_default_timezone_set("America/Sao_Paulo");
--FILE--
<?php
$dftz021 = date_default_timezone_get(); //UTC
date_timestamp_set(987654321, 123456789);
?>
--EXPECTF--
Warning: date_timestamp_set() expects parameter 1 to be DateTime, integer given in %s on line %d

View File

@ -0,0 +1,19 @@
--TEST--
Check the function date_timestamp_set() with second parameter wrong (array).
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--INI--
date.timezone = UTC;
date_default_timezone_set("America/Sao_Paulo");
--FILE--
<?php
$dftz021 = date_default_timezone_get(); //UTC
$dtms021 = new DateTime();
$wrong_parameter = array();
date_timestamp_set($dtms021, $wrong_parameter);
?>
--EXPECTF--
Warning: date_timestamp_set() expects parameter 2 to be long, array given in %s on line %d

View File

@ -0,0 +1,17 @@
--TEST--
Check the function date_timestamp_set() with 3 parameters.
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--INI--
date.timezone = UTC;
date_default_timezone_set("America/Sao_Paulo");
--FILE--
<?php
$dftz021 = date_default_timezone_get(); //UTC
$dtms021 = new DateTime();
date_timestamp_set($dtms021, 123456789, 'error');
?>
--EXPECTF--
Warning: date_timestamp_set() expects exactly 2 parameters, 3 given in %s on line %d

View File

@ -0,0 +1,13 @@
--TEST--
Test the basics to function timezone_version_get().
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--INI--
date.timezone = UTC;
date_default_timezone_set("America/Sao_Paulo");
--FILE--
<?php
var_dump(timezone_version_get());
?>
--EXPECTREGEX--
string\([6-7]\) \"20[0-9][0-9]\.[1-9][0-9]?\"

View File

@ -0,0 +1,12 @@
--TEST--
timezone_version_get: Test that timezone_location_get returns a date concatenated with a dot and a version number
--CREDITS--
Rodrigo Wanderley de Melo Cardoso <rodrigogepem@gmail.com>
#PHPTestFest2014 São Paulo 2014-07-05
--INI--
date.timezone=UTC
--FILE--
<?php $versionTimezone = timezone_version_get();
echo $versionTimezone; ?>
--EXPECTREGEX--
^[12][0-9]{3}.[0-9]+$

View File

@ -10,8 +10,8 @@ var_dump(exif_thumbnail(__DIR__."/bug68113.jpg"));
?>
Done
--EXPECTF--
Warning: exif_thumbnail(bug68113.jpg): File structure corrupted in %s/bug68113.php on line 2
Warning: exif_thumbnail(bug68113.jpg): File structure corrupted in %s%ebug68113.php on line 2
Warning: exif_thumbnail(bug68113.jpg): Invalid JPEG file in %s/bug68113.php on line 2
Warning: exif_thumbnail(bug68113.jpg): Invalid JPEG file in %s%ebug68113.php on line 2
bool(false)
Done
Done

View File

@ -3,7 +3,7 @@ if(!extension_loaded('fileinfo')) {
dl('fileinfo.' . PHP_SHLIB_SUFFIX);
}
if(!extension_loaded('fileinfo')) {
die("fileinfo extension is not avaliable, please compile it.\n");
die("fileinfo extension is not available, please compile it.\n");
}
// normal operation

View File

@ -351,7 +351,7 @@
*
* Revision 1.8 93/02/19 15:01:26 ian
* Numerous changes from Guy Harris too numerous to mention but including
* byte-order independance, fixing "old-style masking", etc. etc. A bugfix
* byte-order independence, fixing "old-style masking", etc. etc. A bugfix
* for broken symlinks from martin@@d255s004.zfe.siemens.de.
*
* Revision 1.7 93/01/05 14:57:27 ian

View File

@ -3918,7 +3918,7 @@
>7 string x version %.2s
# We skip the path here, because it is often long (so file will
# truncate it) and mostly redundant.
# The inverted index functionality was added some time betwen
# The inverted index functionality was added some time between
# versions 11 and 15, so look for -q if version is above 14:
>7 string >14
>>10 search/100 \ -q\ with inverted index
@ -3972,7 +3972,7 @@
# .cwk
0 string \002\000\210\003\102\117\102\117\000\001\206 Claris works document
# .plt
0 string \020\341\000\000\010\010 Claris Works pallete files .plt
0 string \020\341\000\000\010\010 Claris Works palette files .plt
# .msp a dictionary file I am not sure about this I have only one .msp file
0 string \002\271\262\000\040\002\000\164 Claris works dictionary
@ -4443,9 +4443,9 @@
>6 byte&0x04 =0x8 \b, [4-Scr]
#------------------------------------------------------------------------------
# gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format
# game boy: file(1) magic for the Nintendo (Color) Game Boy raw ROM format
#
0x104 belong 0xCEED6666 Gameboy ROM:
0x104 belong 0xCEED6666 Game Boy ROM:
>0x134 string >\0 "%.16s"
>0x146 byte 0x03 \b,[SGB]
>0x147 byte 0x00 \b, [ROM ONLY]
@ -4605,8 +4605,8 @@
0 string \x01ZZZZZ\x01 3DO "Opera" file system
# From Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
0 string GBS Nintendo Gameboy Music/Audio Data
12 string GameBoy\ Music\ Module Nintendo Gameboy Music Module
0 string GBS Nintendo Game Boy Music/Audio Data
12 string GameBoy\ Music\ Module Nintendo Game Boy Music Module
# Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at>
0 string PPF30 Playstation Patch File version 3.0
@ -15279,7 +15279,7 @@
# $File: oasis,v 1.1 2011/03/15 02:09:38 christos Exp $
# OASIS
# Summary: OASIS stream file
# Long descripton: Open Artwork System Interchange Standard
# Long description: Open Artwork System Interchange Standard
# File extension: .oas
# Full name: Ben Cowley (bcowley@broadcom.com)
# Philip Dixon (pdixon@broadcom.com)

View File

@ -766,7 +766,7 @@ PHP_FUNCTION(filter_input)
/* }}} */
/* {{{ proto mixed filter_var(mixed variable [, long filter [, mixed options]])
* Returns the filtered version of the vriable.
* Returns the filtered version of the variable.
*/
PHP_FUNCTION(filter_var)
{

View File

@ -69,8 +69,8 @@ typedef struct ftpbuf
ftptype_t type; /* current transfer type */
int pasv; /* 0=off; 1=pasv; 2=ready */
php_sockaddr_storage pasvaddr; /* passive mode address */
zend_long timeout_sec; /* User configureable timeout (seconds) */
int autoseek; /* User configureable autoseek flag */
zend_long timeout_sec; /* User configurable timeout (seconds) */
int autoseek; /* User configurable autoseek flag */
int nb; /* "nonblocking" transfer in progress */
databuf_t *data; /* Data connection for "nonblocking" transfers */

View File

@ -782,7 +782,7 @@ int gdImageBrightness(gdImagePtr src, int brightness);
/* Set the contrast level <contrast> for the image <src> */
int gdImageContrast(gdImagePtr src, double contrast);
/* Simply adds or substracts respectively red, green or blue to a pixel */
/* Simply adds or subtracts respectively red, green or blue to a pixel */
int gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha);
/* Image convolution by a 3x3 custom matrix */

View File

@ -1,6 +1,6 @@
/* This is potentially great stuff, but fails against the test
program at the end. This would probably be much more
efficent than the implementation currently in gd.c if the
efficient than the implementation currently in gd.c if the
errors in the output were corrected. TBB */
#if 0

View File

@ -464,7 +464,7 @@ static void *fontFetch (char **error, void *key)
return NULL;
}
/* FIXME - This mapping stuff is imcomplete - where is the spec? */
/* FIXME - This mapping stuff is incomplete - where is the spec? */
/* EAM - It's worse than that. It's pointless to match character encodings here.
* As currently written, the stored a->face->charmap only matches one of
* the actual charmaps and we cannot know at this stage if it is the right

View File

@ -169,7 +169,7 @@ static inline uint32 get_le32(const uint8* const data) {
* Y2/U2/V2: The Y/U/V data of the second image
*
* Returns the PSNR (http://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio)
* value computed bewteen the two images
* value computed between the two images
*/
double GetPSNRYuv(const uint8* Y1,
const uint8* U1,
@ -210,7 +210,7 @@ double GetPSNRYuv(const uint8* Y1,
* imgdata: data buffer containing webp image
* imgdata_size: size of the imgdata buffer
*
* Returns the PSNR value computed bewteen the two images
* Returns the PSNR value computed between the two images
*/
double WebPGetPSNR(const uint8* Y1,
const uint8* U1,

View File

@ -57,7 +57,7 @@ typedef enum WebPResultType {
* 3. p_Y/p_U/p_V : pointer to the Y/U/V data buffer (this routine will
* allocate memory for the buffer, fill the buffer with
* appropriate data and transfer owner ship of the buffer
* to caller. Caller is reponsible for freeing the memory).
* to caller. Caller is responsible for freeing the memory).
* Note that the memory for Y, U, V buffers is alloacted
* in one chunk, hence one should call free(*p_Y) only.
* Do not try to free the U and V buffers.

View File

@ -0,0 +1,19 @@
--TEST--
test imagealphablending without arguments
--CREDITS--
Marcelo Diniz <marcelo.leo27 [at] gmail [dot] com
#phpspMaisTestFest PHPSP on 2014-07-05
--SKIPIF--
<?php
if (!extension_loaded('gd')) die("skip gd extension not available.");
?>
--FILE--
<?php
imagealphablending();
?>
--EXPECTF--
Warning: imagealphablending() expects exactly 2 parameters, 0 given in %s on line %d

View File

@ -0,0 +1,19 @@
--TEST--
test imagecolorresolvealpha without arguments
--CREDITS--
Marcelo Diniz <marcelo.leo27 [at] gmail [dot] com
#phpspMaisTestFest PHPSP on 2014-07-05
--SKIPIF--
<?php
if (!extension_loaded('gd')) die("skip gd extension not available.");
?>
--FILE--
<?php
imagecolorresolvealpha();
?>
--EXPECTF--
Warning: imagecolorresolvealpha() expects exactly 5 parameters, 0 given in %s on line %d

View File

@ -0,0 +1,19 @@
--TEST--
test imagesavealpha without arguments
--CREDITS--
Marcelo Diniz <marcelo.leo27 [at] gmail [dot] com
#phpspMaisTestFest PHPSP on 2014-07-05
--SKIPIF--
<?php
if (!extension_loaded('gd')) die("skip gd extension not available.");
?>
--FILE--
<?php
imagesavealpha();
?>
--EXPECTF--
Warning: imagesavealpha() expects exactly 2 parameters, 0 given in %s on line %d

Binary file not shown.

View File

@ -0,0 +1,17 @@
msgid ""
msgstr ""
"Project-Id-Version: bugs.php.net/66265\n"
"POT-Creation-Date: 2014-11-20 16:33+0100\n"
"PO-Revision-Date: 2014-11-20 16:40+0100\n"
"Last-Translator: <ab@php.net>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.6.10\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: de_DE\n"
msgid "hello"
msgstr "hallo"

Binary file not shown.

View File

@ -0,0 +1,17 @@
msgid ""
msgstr ""
"Project-Id-Version: bugs.php.net/66265\n"
"POT-Creation-Date: 2014-11-20 16:33+0100\n"
"PO-Revision-Date: 2014-11-20 16:40+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.6.10\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: en_US\n"
msgid "hello"
msgstr "hello"

Binary file not shown.

View File

@ -0,0 +1,17 @@
msgid ""
msgstr ""
"Project-Id-Version: bugs.php.net/66265\n"
"POT-Creation-Date: 2014-11-20 16:33+0100\n"
"PO-Revision-Date: 2014-11-20 16:59+0100\n"
"Last-Translator: <ab@php.net>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.6.10\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: fr_FR\n"
msgid "hello"
msgstr "salut"

View File

@ -0,0 +1,55 @@
--TEST--
#66265: gettext doesn't switch locales within the same script
--SKIPIF--
<?php
if (!extension_loaded("gettext")) {
die("skip\n");
}
if (PHP_ZTS) {
/* this is supposed to fail on the TS build at least on Windows,
should be even XFAIL till it's fixed there */
die("skip NTS only");
}
if (substr(PHP_OS, 0, 3) != 'WIN') {
$loc = ["de_DE", "fr_FR", "en_US"];
foreach($loc as $l) {
if (!setlocale(LC_ALL, $l)) {
die("SKIP '$l' locale not supported.");
}
}
}
?>
--FILE--
<?php
$domain = 'domain';
$loc = ["de_DE", "fr_FR", "en_US"];
foreach ($loc as $l) {
putenv("LC_ALL=$l");
$path = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . "66265");
bindtextdomain($domain, $path);
bind_textdomain_codeset($domain, "UTF-8");
textdomain($domain);
echo 'LC_ALL=', getenv('LC_ALL'), "\n";
echo 'hello=', _('hello'), "\n";
echo "\n";
}
?>
==DONE==
--EXPECTF--
LC_ALL=de_DE
hello=hallo
LC_ALL=fr_FR
hello=salut
LC_ALL=en_US
hello=hello
==DONE==

View File

@ -0,0 +1,19 @@
--TEST--
Test the basics to function iconv.
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--SKIPIF--
<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
<?php if(substr(PHP_OS, 0, 3) != 'WIN' ) {die('skip windows only test');} ?>
--FILE--
<?php
$in_charset = 'UTF-8';
$out_charset = 'ASCII//TRANSLIT';
$string_to_translate = 'Žluťoučký kůň\n';
$string_out = iconv($in_charset, $out_charset, $string_to_translate);
var_dump($string_out);
?>
--EXPECT--
string(16) "Zlutouck'y kun\n"

View File

@ -0,0 +1,19 @@
--TEST--
Test the basics to function iconv.
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--SKIPIF--
<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
<?php if(substr(PHP_OS, 0, 3) == 'WIN' ) {die('skip not for windows');} ?>
--FILE--
<?php
$in_charset = 'UTF-8';
$out_charset = 'ASCII//TRANSLIT';
$string_to_translate = 'Žluťoučký kůň\n';
$string_out = iconv($in_charset, $out_charset, $string_to_translate);
var_dump($string_out);
?>
--EXPECT--
string(15) "Zlutoucky kun\n"

View File

@ -3,7 +3,7 @@ InterBase: connect, close and pconnect
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php /* $Id$ */
<?php
require("interbase.inc");

View File

@ -3,7 +3,7 @@ InterBase: misc sql types (may take a while)
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php /* $Id$ */
<?php
require("interbase.inc");
ibase_connect($test_base);

View File

@ -3,7 +3,7 @@ InterBase: BLOB test
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php /* $Id$ */
<?php
require("interbase.inc");

View File

@ -3,7 +3,7 @@ InterBase: transactions
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php /* $Id$ */
<?php
require("interbase.inc");
@ -63,7 +63,7 @@ simple default transaction test without ibase_trans()
/*
default transaction on default link
First open transaction on link will be default.
$tr_def_l1 may be ommited. All queryes without link and trans
$tr_def_l1 may be omitted. All queryes without link and trans
parameters run in this context
*/

View File

@ -3,7 +3,7 @@ InterBase: binding (may take a while)
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php /* $Id$ */
<?php
require("interbase.inc");

View File

@ -3,7 +3,7 @@ InterBase: array handling
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php /* $Id$ */
<?php
require("interbase.inc");

View File

@ -6,7 +6,7 @@ if (PHP_OS == "WINNT") echo "skip";
include("skipif.inc");
?>
--FILE--
<?php /* $Id$ */
<?php
require("interbase.inc");

View File

@ -0,0 +1,30 @@
--TEST--
Bug #67052 - NumberFormatter::parse() resets LC_NUMERIC setting
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') {
die("skip Valid only on Windows");
}
?>
--FILE--
<?php
function ut_main()
{
setlocale(LC_ALL, 'de-de');
$fmt = new NumberFormatter( 'sl_SI.UTF-8', NumberFormatter::DECIMAL);
$num = "1.234.567,891";
$res_str = $fmt->parse($num)."\n";
$res_str .= setlocale(LC_NUMERIC, 0);
return $res_str;
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
1234567,891
de-de

View File

@ -2,6 +2,11 @@
Bug #67052 - NumberFormatter::parse() resets LC_NUMERIC setting
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
die("skip Valid only on non Windows");
}
?>
--FILE--
<?php

View File

@ -1149,7 +1149,7 @@ zval *php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node ex
{
php_libxml_func_handler export_hnd;
/* Initialize in case this module hasnt been loaded yet */
/* Initialize in case this module hasn't been loaded yet */
php_libxml_initialize();
export_hnd.export_func = export_function;

View File

@ -371,7 +371,7 @@ o i18n.internal_encoding - internal encoding
encodings, following conditions have to be satisfied in order
to use them:
- per byte encoding
- single byte charactor in range of 00h-7fh which is compatible
- single byte character in range of 00h-7fh which is compatible
with ASCII
- multibyte without 00h-7fh
In case of Japanese, EUC-JP and UTF-8 are the only encoding that
@ -408,7 +408,7 @@ o i18n.script_encoding - script encoding
entering the script parser.
Be aware that auto detection may fail under some conditions.
For best auto detection, add multibyte charactor at beginning of
For best auto detection, add multibyte character at beginning of
script.

View File

@ -22,7 +22,7 @@
*
*/
/* charactor property table */
/* character property table */
#define MBFL_CHP_CTL 0x01
#define MBFL_CHP_DIGIT 0x02
#define MBFL_CHP_UALPHA 0x04

View File

@ -45,7 +45,7 @@
#define MBFL_ENCTYPE_ENC_STRM 0x00002000
#define MBFL_ENCTYPE_GL_UNSAFE 0x00004000
/* wchar plane, special charactor */
/* wchar plane, special character */
#define MBFL_WCSPLANE_MASK 0xffff
#define MBFL_WCSPLANE_UCS2MAX 0x00010000
#define MBFL_WCSPLANE_UTF32MAX 0x00110000

View File

@ -14,7 +14,7 @@ function_exists('mb_strtolower') or die("skip mb_strtolower() is not available i
/*
* Pass a Japanese string and a mixed Japanese and ASCII string to mb_strtolower
* to check correct conversion is occuring (Japanese characters should not be converted).
* to check correct conversion is occurring (Japanese characters should not be converted).
*/
echo "*** Testing mb_strtolower() : usage variations ***\n";

View File

@ -14,7 +14,7 @@ function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available i
/*
* Pass a Japanese string and a mixed Japanese and ASCII string to mb_strtolower
* to check correct conversion is occuring (Japanese characters should not be converted).
* to check correct conversion is occurring (Japanese characters should not be converted).
*/
echo "*** Testing mb_strtoupper() : usage variations ***\n";

View File

@ -23,7 +23,7 @@ $cipher = MCRYPT_TRIPLEDES;
$data = b"This is the secret message which must be encrypted";
$mode = MCRYPT_DECRYPT;
// tripledes uses keys upto 192 bits (24 bytes)
// tripledes uses keys up to 192 bits (24 bytes)
$keys = array(
b'12345678',
b'12345678901234567890',

View File

@ -23,7 +23,7 @@ $cipher = MCRYPT_TRIPLEDES;
$data = b"This is the secret message which must be encrypted";
$mode = MCRYPT_ENCRYPT;
// tripledes uses keys upto 192 bits (24 bytes)
// tripledes uses keys up to 192 bits (24 bytes)
$keys = array(
b'12345678',
b'12345678901234567890',

View File

@ -21,13 +21,13 @@ echo "*** Testing mcrypt_encrypt() : TripleDES functionality ***\n";
//test tripledes, aes
//test different lengths of key, iv
//test no iv being passed on CBC, ECB
//test upto 32 bytes with unlimited strength
//test up to 32 bytes with unlimited strength
$cipher = MCRYPT_TRIPLEDES;
$mode = MCRYPT_MODE_CBC;
$data = b'This is the secret message which must be encrypted';
// tripledes uses keys upto 192 bits (24 bytes)
// tripledes uses keys up to 192 bits (24 bytes)
$keys = array(
b'12345678',
b'12345678901234567890',

View File

@ -20,7 +20,7 @@ $cipher = MCRYPT_TRIPLEDES;
$mode = MCRYPT_MODE_ECB;
$data = b'This is the secret message which must be encrypted';
// tripledes uses keys upto 192 bits (24 bytes)
// tripledes uses keys up to 192 bits (24 bytes)
$keys = array(
b'12345678',
b'12345678901234567890',

View File

@ -30,7 +30,7 @@ $cipher = MCRYPT_RIJNDAEL_128;
$mode = MCRYPT_MODE_CBC;
$data = b'This is the secret message which must be encrypted';
// keys upto 128 bits (16 bytes)
// keys up to 128 bits (16 bytes)
$keys = array(
null,
'',

View File

@ -44,8 +44,8 @@ require_once('skipifconnectfailure.inc');
if ($IS_MYSQLND) {
/*
Advantage mysqlnd -
The metadata mysqlnd has availabe after prepare is better than
the one made availabe by the MySQL Client Library (libmysql).
The metadata mysqlnd has available after prepare is better than
the one made available by the MySQL Client Library (libmysql).
"libmysql" will give wrong results and that is OK -
http://bugs.mysql.com/bug.php?id=47483
*/

View File

@ -19,7 +19,7 @@ require_once('skipifconnectfailure.inc');
$idx = 0;
while ($row = mysqli_fetch_assoc($res)) {
/* mysqlnd: force seperation - create copies */
/* mysqlnd: force separation - create copies */
$references[$idx] = array(
'id' => &$row['id'],
'label' => $row['label'] . '');
@ -30,7 +30,7 @@ require_once('skipifconnectfailure.inc');
mysqli_data_seek($res, 0);
while ($row = mysqli_fetch_assoc($res)) {
/* mysqlnd: force seperation - create copies */
/* mysqlnd: force separation - create copies */
$references[$idx] = array(
'id' => &$row['id'],
'label' => $row['label'] . '');
@ -48,7 +48,7 @@ require_once('skipifconnectfailure.inc');
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
while ($row = mysqli_fetch_assoc($res)) {
/* mysqlnd: force seperation - create copies*/
/* mysqlnd: force separation - create copies*/
$references[$idx] = array(
'id' => &$row['id'],
'label' => $row['label'] . '');

View File

@ -48,7 +48,7 @@ if ((version_compare(PHP_VERSION, '6.0', '==') == 1))
$references[$idx]['row_copy'] = $rows[$i];
$references[$idx]['id_ref'] = &$rows[$i]['id'];
$references[$idx]['id_copy'] = $rows[$i]['id'];
/* enforce seperation */
/* enforce separation */
$references[$idx]['id_copy_mod']= $rows[$i]['id'] + 0;
}
mysqli_free_result($res);

View File

@ -21,9 +21,9 @@ require_once('skipifconnectfailure.inc');
echo "Test 1:\n";
$stmt = $link->prepare("SELECT ? FOO");
var_dump($foo); // here you can see the bar member var beeing a string
var_dump($foo); // here you can see the bar member var being a string
$stmt->bind_param("s", $foo->bar);
var_dump($foo); // this will show $foo->bar beeing a reference string
var_dump($foo); // this will show $foo->bar being a reference string
$stmt->bind_result($one);
$stmt->execute();
$stmt->fetch();

View File

@ -242,7 +242,7 @@ static ZEND_INI_MH(OnEnable)
}
ZEND_INI_BEGIN()
STD_PHP_INI_BOOLEAN("opcache.enable" , "1", PHP_INI_ALL, OnEnable, enabled , zend_accel_globals, accel_globals)
STD_PHP_INI_BOOLEAN("opcache.enable" , "1", PHP_INI_ALL, OnEnable, enabled , zend_accel_globals, accel_globals)
STD_PHP_INI_BOOLEAN("opcache.use_cwd" , "1", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.use_cwd , zend_accel_globals, accel_globals)
STD_PHP_INI_BOOLEAN("opcache.validate_timestamps", "1", PHP_INI_ALL , OnUpdateBool, accel_directives.validate_timestamps, zend_accel_globals, accel_globals)
STD_PHP_INI_BOOLEAN("opcache.inherited_hack" , "1", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.inherited_hack , zend_accel_globals, accel_globals)
@ -448,7 +448,7 @@ static zend_module_entry accel_module_entry = {
NULL,
NULL,
zend_accel_info,
ACCELERATOR_VERSION "FE",
ACCELERATOR_VERSION "FE",
STANDARD_MODULE_PROPERTIES
};

View File

@ -3,7 +3,7 @@ Bug #64802: openssl_x509_parse fails to parse subject properly in some cases
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
if (!defined(OPENSSL_KEYTYPE_EC)) die("skip no EC available);
if (!defined('OPENSSL_KEYTYPE_EC')) die("skip no EC available");
?>
--FILE--
<?php

View File

@ -1,7 +1,7 @@
Process Control Module for PHP (pcntl)
This module will attempt to implement all features related to process spawning and
control (fork(), waitpid(), signal(), WIF's, etc). This is extremly experimental,
control (fork(), waitpid(), signal(), WIF's, etc). This is extremely experimental,
with hope to become stable on most UNIX's. I greatly apreciate any feedback, fixes,
and or suggestions on how to improve/better implement
this functionality.

View File

@ -1544,7 +1544,7 @@ Version 8.10 25-Jun-2010
7. Minor change to pcretest.c to avoid a compiler warning.
8. Added four artifical Unicode properties to help with an option to make
8. Added four artificial Unicode properties to help with an option to make
\s etc use properties (see next item). The new properties are: Xan
(alphanumeric), Xsp (Perl space), Xps (POSIX space), and Xwd (word).
@ -4169,7 +4169,7 @@ Version 4.3 21-May-03
(i) The utf8_table... variables are now declared "const".
(ii) The code for \cx, which used the "case flipping" table to upper case
lower case letters, now just substracts 32. This is ASCII-specific,
lower case letters, now just subtracts 32. This is ASCII-specific,
but the whole concept of \cx is ASCII-specific, so it seems
reasonable.

View File

@ -360,7 +360,7 @@ reference number if the reference is to a unique capturing group (either by
number or by name). When named groups are used, there may be more than one
group with the same name. In this case, a reference by name generates OP_DNREF
or OP_DNREFI. These are followed by two counts: the index (not the byte offset)
in the group name table of the first entry for the requred name, followed by
in the group name table of the first entry for the required name, followed by
the number of groups with the same name.

View File

@ -392,7 +392,7 @@ library. They are also documented in the pcrebuild man page.
avoided by linking with libedit (which has a BSD licence) instead.
Enabling libreadline causes the -lreadline option to be added to the pcretest
build. In many operating environments with a sytem-installed readline
build. In many operating environments with a system-installed readline
library this is sufficient. However, in some environments (e.g. if an
unmodified distribution version of readline is in use), it may be necessary
to specify something like LIBS="-lncurses" as well. This is because, to quote

View File

@ -1242,7 +1242,7 @@ PCRETEST OPTION FOR LIBREADLINE SUPPORT
pcretest linked in this way, there may be licensing issues.
Setting this option causes the -lreadline option to be added to the
pcretest build. In many operating environments with a sytem-installed
pcretest build. In many operating environments with a system-installed
libreadline this is sufficient. However, in some environments (e.g. if
an unmodified distribution version of readline is in use), some extra
configuration may be necessary. The INSTALL file for libreadline says

View File

@ -1038,7 +1038,7 @@ for (;;)
the result of a recursive call to match() whatever happened so it was
possible to reduce stack usage by turning this into a tail recursion,
except in the case of a possibly empty group. However, now that there is
the possiblity of (*THEN) occurring in the final alternative, this
the possibility of (*THEN) occurring in the final alternative, this
optimization is no longer always possible.
We can optimize if we know there are no (*THEN)s in the pattern; at present

View File

@ -68,7 +68,7 @@ appropriately for an application, not for building PCRE. */
#include "pcre.h"
#include "pcre_internal.h"
/* These are the funtions that are contained within. It doesn't seem worth
/* These are the functions that are contained within. It doesn't seem worth
having a separate .h file just for this. */
#endif /* PCRE_INCLUDED */

Some files were not shown because too many files have changed in this diff Show More