1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 23:18:13 +02:00

Merge branch 'master' of git.php.net:php-src

This commit is contained in:
Xinchen Hui
2015-08-18 18:07:25 +08:00
15 changed files with 96 additions and 22 deletions
+1 -1
View File
@@ -153,7 +153,7 @@ define ____printzv_contents
# 15 == IS_INDIRECT
if $type >= 5 && $type != 15
printf "(refcount=%d) ", $zvalue->value.counted->refcount
printf "(refcount=%d) ", $zvalue->value.counted->gc.refcount
end
if $type == 0
+2
View File
@@ -31,6 +31,8 @@ PHP NEWS
object or string). (cmb)
. Fixed bug #70266 (DateInterval::__construct.interval_spec is not supposed to
be optional). (cmb)
. Fixed bug #70277 (new DateTimeZone($foo) is ignoring text after null byte).
(cmb)
- MCrypt:
. Fixed bug #69833 (mcrypt fd caching not working). (Anatol)
+2
View File
@@ -202,6 +202,8 @@ TSRM_API void *tsrm_get_ls_cache(void);
#define TSRMLS_CACHE_UPDATE()
#define TSRMLS_CACHE
#define TSRM_TLS
/* BC only */
#define TSRMLS_D void
#define TSRMLS_DC
+7 -1
View File
@@ -917,7 +917,13 @@ static zend_bool do_inherit_constant_check(HashTable *child_constants_table, zva
static void do_inherit_iface_constant(zend_string *name, zval *zv, zend_class_entry *ce, zend_class_entry *iface) /* {{{ */
{
if (do_inherit_constant_check(&ce->constants_table, zv, name, iface)) {
ZVAL_MAKE_REF(zv);
if (!Z_ISREF_P(zv)) {
if (iface->type == ZEND_INTERNAL_CLASS) {
ZVAL_NEW_PERSISTENT_REF(zv, zv);
} else {
ZVAL_NEW_REF(zv, zv);
}
}
Z_ADDREF_P(zv);
if (Z_CONSTANT_P(Z_REFVAL_P(zv))) {
ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
+9 -4
View File
@@ -3601,12 +3601,17 @@ PHP_FUNCTION(date_diff)
}
/* }}} */
static int timezone_initialize(php_timezone_obj *tzobj, /*const*/ char *tz) /* {{{ */
static int timezone_initialize(php_timezone_obj *tzobj, /*const*/ char *tz, size_t tz_len) /* {{{ */
{
timelib_time *dummy_t = ecalloc(1, sizeof(timelib_time));
int dst, not_found;
char *orig_tz = tz;
if (strlen(tz) != tz_len) {
php_error_docref(NULL, E_WARNING, "Timezone must not contain null bytes");
return FAILURE;
}
dummy_t->z = timelib_parse_zone(&tz, &dst, dummy_t, &not_found, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
if (not_found) {
php_error_docref(NULL, E_WARNING, "Unknown or bad timezone (%s)", orig_tz);
@@ -3633,7 +3638,7 @@ PHP_FUNCTION(timezone_open)
RETURN_FALSE;
}
tzobj = Z_PHPTIMEZONE_P(php_date_instantiate(date_ce_timezone, return_value));
if (SUCCESS != timezone_initialize(tzobj, tz)) {
if (SUCCESS != timezone_initialize(tzobj, tz, tz_len)) {
zval_ptr_dtor(return_value);
RETURN_FALSE;
}
@@ -3656,7 +3661,7 @@ PHP_METHOD(DateTimeZone, __construct)
zend_replace_error_handling(EH_THROW, NULL, &error_handling);
tzobj = Z_PHPTIMEZONE_P(getThis());
timezone_initialize(tzobj, tz);
timezone_initialize(tzobj, tz, tz_len);
zend_restore_error_handling(&error_handling);
}
/* }}} */
@@ -3674,7 +3679,7 @@ static int php_date_timezone_initialize_from_hash(zval **return_value, php_timez
if (Z_TYPE_P(z_timezone) != IS_STRING) {
return FAILURE;
}
if (SUCCESS == timezone_initialize(*tzobj, Z_STRVAL_P(z_timezone))) {
if (SUCCESS == timezone_initialize(*tzobj, Z_STRVAL_P(z_timezone), Z_STRLEN_P(z_timezone))) {
return SUCCESS;
}
}
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #70277 (new DateTimeZone($foo) is ignoring text after null byte)
--FILE--
<?php
$timezone = "Europe/Zurich\0Foo";
var_dump(timezone_open($timezone));
var_dump(new DateTimeZone($timezone));
?>
--EXPECTF--
Warning: timezone_open(): Timezone must not contain null bytes in %sbug70277.php on line %d
bool(false)
Fatal error: Uncaught Exception: DateTimeZone::__construct(): Timezone must not contain null bytes in %sbug70277.php:%d
Stack trace:
#0 %sbug70277.php(%d): DateTimeZone->__construct('Europe/Zurich\x00F...')
#1 {main}
thrown in %sbug70277.php on line %d
@@ -0,0 +1,40 @@
--TEST--
resource enchant_broker_request_pwl_dict(resource $broker, string $filename); function
--CREDITS--
marcosptf - <marcosptf@yahoo.com.br>
--SKIPIF--
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if(!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
?>
--FILE--
<?php
$broker = enchant_broker_init();
$pathPwlDict = __DIR__ . "/enchant_broker_request_pwl_dict.pwl";
if (is_resource($broker)) {
echo("OK\n");
$requestDict = enchant_broker_request_pwl_dict($broker, $pathPwlDict);
if (is_resource($requestDict)) {
echo("OK\n");
$dictdescribe = enchant_dict_describe($requestDict);
if ($pathPwlDict === $dictdescribe['file']) {
echo("OK\n");
} else {
echo("broker dict describe is not a resource failed\n");
}
} else {
echo("dict broker request pwl has failed\n");
}
} else {
echo("broker is not a resource; failed;\n");
}
echo "OK\n";
?>
--EXPECT--
OK
OK
OK
OK
@@ -0,0 +1,10 @@
java
perl
awk
clang
php
python
cplusplus
csharp
bash
ruby
-1
View File
@@ -401,7 +401,6 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c
{
char *s, *content_type, *mimetype = NULL;
int output_status, mimetype_len = 0;
PHP_OUTPUT_TSRMLS(output_context);
if (output_context->op & PHP_OUTPUT_HANDLER_START) {
output_status = php_output_get_status();
+5 -1
View File
@@ -4822,6 +4822,10 @@ PHP_FUNCTION(openssl_verify)
return;
}
if (UINT_MAX < signature_len) {
php_error_docref(NULL, E_WARNING, "signature is too long");
RETURN_FALSE;
}
if (method == NULL || Z_TYPE_P(method) == IS_LONG) {
if (method != NULL) {
signature_algo = Z_LVAL_P(method);
@@ -4846,7 +4850,7 @@ PHP_FUNCTION(openssl_verify)
EVP_VerifyInit (&md_ctx, mdtype);
EVP_VerifyUpdate (&md_ctx, data, data_len);
err = EVP_VerifyFinal (&md_ctx, (unsigned char *)signature, (int)signature_len, pkey);
err = EVP_VerifyFinal(&md_ctx, (unsigned char *)signature, (unsigned int)signature_len, pkey);
EVP_MD_CTX_cleanup(&md_ctx);
if (keyresource == NULL) {
-1
View File
@@ -1149,7 +1149,6 @@ static int php_tidy_output_handler(void **nothing, php_output_context *output_co
int status = FAILURE;
TidyDoc doc;
TidyBuffer inbuf, outbuf, errbuf;
PHP_OUTPUT_TSRMLS(output_context);
if (TG(clean_output) && (output_context->op & PHP_OUTPUT_HANDLER_START) && (output_context->op & PHP_OUTPUT_HANDLER_FINAL)) {
doc = tidyCreate();
-2
View File
@@ -124,7 +124,6 @@ static int php_zlib_output_encoding(void)
static int php_zlib_output_handler_ex(php_zlib_context *ctx, php_output_context *output_context)
{
int flags = Z_SYNC_FLUSH;
PHP_OUTPUT_TSRMLS(output_context);
if (output_context->op & PHP_OUTPUT_HANDLER_START) {
/* start up */
@@ -210,7 +209,6 @@ static int php_zlib_output_handler_ex(php_zlib_context *ctx, php_output_context
static int php_zlib_output_handler(void **handler_context, php_output_context *output_context)
{
php_zlib_context *ctx = *(php_zlib_context **) handler_context;
PHP_OUTPUT_TSRMLS(output_context);
if (!php_zlib_output_encoding()) {
/* "Vary: Accept-Encoding" header sent along uncompressed content breaks caching in MSIE,
-2
View File
@@ -909,7 +909,6 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl
{
php_output_handler_status_t status;
int original_op = context->op;
PHP_OUTPUT_TSRMLS(context);
#if PHP_OUTPUT_DEBUG
fprintf(stderr, ">>> op(%d, "
@@ -1249,7 +1248,6 @@ static inline int php_output_stack_pop(int flags)
static int php_output_handler_compat_func(void **handler_context, php_output_context *output_context)
{
php_output_handler_func_t func = *(php_output_handler_func_t *) handler_context;
PHP_OUTPUT_TSRMLS(output_context);
if (func) {
char *out_str = NULL;
+1 -4
View File
@@ -95,7 +95,7 @@ typedef struct _php_output_buffer {
size_t size;
size_t used;
uint free:1;
uint _res:31;
uint _reserved:31;
} php_output_buffer;
typedef struct _php_output_context {
@@ -104,9 +104,6 @@ typedef struct _php_output_context {
php_output_buffer out;
} php_output_context;
/* XXX remove this after TLS branch merge */
#define PHP_OUTPUT_TSRMLS(ctx)
/* old-style, stateless callback */
typedef void (*php_output_handler_func_t)(char *output, size_t output_len, char **handled_output, size_t *handled_output_len, int mode);
/* new-style, opaque context callback */
+2 -5
View File
@@ -16,18 +16,15 @@ var_dump(ini_get('display_errors'));
var_dump(ini_get('error_reporting'));
var_dump(ini_get('log_errors'));
var_dump(ini_get('track_errors'));
ini_set('display_errors', 0);
ini_set('display_errors', "0");
var_dump(ini_get('display_errors'));
var_dump($php_errormsg);
$error = 1 / 0;
var_dump($php_errormsg);
?>
--EXPECTF--
%s: %sivision by zero in %s on line %d
string(1) "1"
string(4) "8191"
string(5) "32767"
string(1) "0"
string(1) "1"
string(1) "0"
string(%d) "%sivision by zer%s"
string(%d) "%sivision by zer%s"