diff options
author | Christopher Jones <sixd@php.net> | 2013-09-13 14:10:53 -0700 |
---|---|---|
committer | Christopher Jones <sixd@php.net> | 2013-09-13 14:10:53 -0700 |
commit | d52dbd569fd0f68ec2c79a96f1a3466c71ef549e (patch) | |
tree | 229c4412dc163d13a880f2650c1499ea02065e31 | |
parent | e5678c9b95a68c28f40c43217e299eb22780a526 (diff) | |
parent | 9eaffd34c123ae5782054cd32bf6caa50ff2b7d2 (diff) | |
download | php-git-d52dbd569fd0f68ec2c79a96f1a3466c71ef549e.tar.gz |
Merge branch 'PHP-5.5' of https://git.php.net/repository/php-src into PHP-5.5
# By Adam Harvey (3) and others
# Via Adam Harvey (2) and Michael Wallner (1)
* 'PHP-5.5' of https://git.php.net/repository/php-src:
fix broken sha2 configure tests
Fixed minor bug in test.
Move NEWS entries to correct version
Fix bug #64782: SplFileObject constructor make $context optional
Fix bug #65502: DateTimeImmutable::createFromFormat returns DateTime
Fix bug #65548: Comparison for DateTimeImmutable doesn't work
Tinker with the wording of the short_open_tag description.
Fix NEWS: these commits were after 5.5.4 was branched and will be in 5.5.5.
Handle CLI server request headers case insensitively.
ensure that the defined interpolation method is used by the generic scaling functions
Fixed issue #128 (opcache_invalidate segmentation fault)
5.4.21 now
-rw-r--r-- | NEWS | 26 | ||||
-rw-r--r-- | ext/date/php_date.c | 32 | ||||
-rw-r--r-- | ext/date/tests/bug65502.phpt | 12 | ||||
-rw-r--r-- | ext/date/tests/bug65548.phpt | 34 | ||||
-rw-r--r-- | ext/gd/libgd/gd_interpolation.c | 5 | ||||
-rw-r--r-- | ext/opcache/ZendAccelerator.c | 4 | ||||
-rw-r--r-- | ext/spl/spl_directory.c | 2 | ||||
-rw-r--r-- | ext/spl/tests/bug64782.phpt | 21 | ||||
-rw-r--r-- | ext/standard/config.m4 | 21 | ||||
-rw-r--r-- | php.ini-development | 13 | ||||
-rw-r--r-- | php.ini-production | 13 | ||||
-rw-r--r-- | sapi/cli/php_cli_server.c | 17 | ||||
-rw-r--r-- | sapi/cli/tests/bug65633.phpt | 48 |
13 files changed, 190 insertions, 58 deletions
@@ -2,6 +2,27 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2013, PHP 5.5.5 +- CLI server: + . Fixed bug #65633 (built-in server treat some http headers as + case-sensitive). (Adam) + +- Datetime: + . Fixed bug #65502 (DateTimeImmutable::createFromFormat returns DateTime). + (Boro Sitnikovski) + . Fixed bug #65548 (Comparison for DateTimeImmutable doesn't work). + (Boro Sitnikovski) + +- GD + . Ensure that the defined interpolation method is used with the generic + scaling methods. (Pierre) + +- OPcache: + . Fixed bug #65510 (5.5.2 crashes in _get_zval_ptr_ptr_var). (Dmitry) + +- SPL: + . Fix bug #64782 (SplFileObject constructor make $context optional / give it + a default value). (Nikita) + ?? ??? 2013, PHP 5.5.4 - Core: @@ -33,7 +54,6 @@ PHP NEWS - OPCache: . Fixed bug #65561 (Zend Opcache on Solaris 11 x86 needs ZEND_MM_ALIGNMENT=4). (Terry Ellison) - . Fixed bug #65510 (5.5.2 crashes in _get_zval_ptr_ptr_var). (Dmitry) - Openssl: . Fixed bug #64802 (openssl_x509_parse fails to parse subject properly in @@ -46,8 +66,8 @@ PHP NEWS session serialize handler that uses plain serialize()). (Yasuo) - Standard: - . Fix issue with return types of password API helper functions. Found via static - analysis by cjones. (Anthony Ferrara) + . Fix issue with return types of password API helper functions. Found via + static analysis by cjones. (Anthony Ferrara) 22 Aug 2013, PHP 5.5.3 diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 95c68f1a78..7d3d1d739e 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -480,7 +480,7 @@ const zend_function_entry date_funcs_immutable[] = { PHP_ME(DateTimeImmutable, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC) PHP_ME(DateTimeImmutable, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME_MAPPING(createFromFormat, date_create_immutable_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0) PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_date_method_timezone_get, 0) @@ -2142,27 +2142,21 @@ static zval* date_clone_immutable(zval *object TSRMLS_DC) static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC) { - if (Z_TYPE_P(d1) == IS_OBJECT && Z_TYPE_P(d2) == IS_OBJECT && - instanceof_function(Z_OBJCE_P(d1), date_ce_date TSRMLS_CC) && - instanceof_function(Z_OBJCE_P(d2), date_ce_date TSRMLS_CC)) { - php_date_obj *o1 = zend_object_store_get_object(d1 TSRMLS_CC); - php_date_obj *o2 = zend_object_store_get_object(d2 TSRMLS_CC); + php_date_obj *o1 = zend_object_store_get_object(d1 TSRMLS_CC); + php_date_obj *o2 = zend_object_store_get_object(d2 TSRMLS_CC); - if (!o1->time || !o2->time) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to compare an incomplete DateTime object"); - return 1; - } - if (!o1->time->sse_uptodate) { - timelib_update_ts(o1->time, o1->time->tz_info); - } - if (!o2->time->sse_uptodate) { - timelib_update_ts(o2->time, o2->time->tz_info); - } - - return (o1->time->sse == o2->time->sse) ? 0 : ((o1->time->sse < o2->time->sse) ? -1 : 1); + if (!o1->time || !o2->time) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to compare an incomplete DateTime or DateTimeImmutable object"); + return 1; + } + if (!o1->time->sse_uptodate) { + timelib_update_ts(o1->time, o1->time->tz_info); + } + if (!o2->time->sse_uptodate) { + timelib_update_ts(o2->time, o2->time->tz_info); } - return 1; + return (o1->time->sse == o2->time->sse) ? 0 : ((o1->time->sse < o2->time->sse) ? -1 : 1); } static HashTable *date_object_get_gc(zval *object, zval ***table, int *n TSRMLS_DC) diff --git a/ext/date/tests/bug65502.phpt b/ext/date/tests/bug65502.phpt new file mode 100644 index 0000000000..8819c1ff74 --- /dev/null +++ b/ext/date/tests/bug65502.phpt @@ -0,0 +1,12 @@ +--TEST-- +Test for bug #65502: DateTimeImmutable::createFromFormat returns DateTime +--CREDITS-- +Boro Sitnikovski <buritomath@yahoo.com> +--INI-- +date.timezone = UTC +--FILE-- +<?php +echo get_class(DateTimeImmutable::createFromFormat('j-M-Y', '12-Sep-2013')); +?> +--EXPECT-- +DateTimeImmutable diff --git a/ext/date/tests/bug65548.phpt b/ext/date/tests/bug65548.phpt new file mode 100644 index 0000000000..53f2519f6d --- /dev/null +++ b/ext/date/tests/bug65548.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test for bug #65548: Comparison for DateTimeImmutable doesn't work +--CREDITS-- +Boro Sitnikovski <buritomath@yahoo.com> +--INI-- +date.timezone = UTC +--FILE-- +<?php +$iToday = new DateTimeImmutable('today'); +$iTomorrow = new DateTimeImmutable('tomorrow'); + +$mToday = new DateTime('today'); +$mTomorrow = new DateTime('tomorrow'); + +var_dump($iToday < $iTomorrow); +var_dump($iToday == $iTomorrow); +var_dump($iToday > $iTomorrow); + +var_dump($iToday == $mToday); +var_dump($iToday === $mToday); + +var_dump($iToday < $mTomorrow); +var_dump($iToday == $mTomorrow); +var_dump($iToday > $mTomorrow); +?> +--EXPECT-- +bool(true) +bool(false) +bool(false) +bool(true) +bool(false) +bool(true) +bool(false) +bool(false) diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c index e3247a78c1..3643535f2e 100644 --- a/ext/gd/libgd/gd_interpolation.c +++ b/ext/gd/libgd/gd_interpolation.c @@ -1065,6 +1065,7 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt if (tmp_im == NULL) { return NULL; } + gdImageSetInterpolationMethod(tmp_im, src->interpolation_id); _gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height); dst = gdImageCreateTrueColor(new_width, new_height); @@ -1072,6 +1073,7 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt gdFree(tmp_im); return NULL; } + gdImageSetInterpolationMethod(dst, src->interpolation_id); _gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height); gdFree(tmp_im); @@ -1086,8 +1088,9 @@ gdImagePtr Scale(const gdImagePtr src, const unsigned int src_width, const unsig if (tmp_im == NULL) { return NULL; } - _gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height); + gdImageSetInterpolationMethod(tmp_im, src->interpolation_id); + _gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height); _gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height); gdFree(tmp_im); diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index b5474c0507..827f047cd4 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -1062,6 +1062,10 @@ int zend_accel_invalidate(const char *filename, int filename_len, zend_bool forc realpath = accelerator_orig_zend_resolve_path(filename, filename_len TSRMLS_CC); #endif + if (!realpath) { + return FAILURE; + } + persistent_script = zend_accel_hash_find(&ZCSG(hash), realpath, strlen(realpath) + 1); if (persistent_script && !persistent_script->corrupted) { zend_file_handle file_handle; diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 1a417d0f58..3dc7b7925c 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2290,7 +2290,7 @@ SPL_METHOD(SplFileObject, __construct) intern->u.file.open_mode = NULL; intern->u.file.open_mode_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|sbr", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|sbr!", &intern->file_name, &intern->file_name_len, &intern->u.file.open_mode, &intern->u.file.open_mode_len, &use_include_path, &intern->u.file.zcontext) == FAILURE) { diff --git a/ext/spl/tests/bug64782.phpt b/ext/spl/tests/bug64782.phpt new file mode 100644 index 0000000000..ac5d08d7d1 --- /dev/null +++ b/ext/spl/tests/bug64782.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #64782: SplFileObject constructor make $context optional / give it a default value +--FILE-- +<?php + +var_dump(new SplFileObject(__FILE__, "r", false, null)); + +?> +--EXPECTF-- +object(SplFileObject)#1 (%d) { + ["pathName":"SplFileInfo":private]=> + string(%d) "%s/bug64782.php" + ["fileName":"SplFileInfo":private]=> + string(12) "bug64782.php" + ["openMode":"SplFileObject":private]=> + string(1) "r" + ["delimiter":"SplFileObject":private]=> + string(1) "," + ["enclosure":"SplFileObject":private]=> + string(1) """ +} diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index 2af2209f2b..3d00d88dda 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -182,12 +182,12 @@ AC_TRY_RUN([ main() { #if HAVE_CRYPT - char salt[30], answer[80]; - - salt[0]='$'; salt[1]='6'; salt[2]='$'; salt[3]='$'; salt[4]='b'; salt[5]='a'; salt[6]='r'; salt[7]='\0'; + char salt[21], answer[21+86]; + + strcpy(salt,"\$6\$rasmuslerdorf\$"); strcpy(answer, salt); - strcpy(&answer[29],"$6$$QMXjqd7rHQZPQ1yHsXkQqC1FBzDiVfTHXL.LaeDAeVV.IzMaV9VU4MQ8kPuZa2SOP1A0RPm772EaFYjpEJtdu."); - exit (strcmp((char *)crypt("foo",salt),answer)); + strcat(answer, "EeHCRjm0bljalWuALHSTs1NB9ipEiLEXLhYeXdOpx22gmlmVejnVXFhd84cEKbYxCo.XuUTrW.RLraeEnsvWs/"); + exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer)); #else exit(0); #endif @@ -211,12 +211,13 @@ AC_TRY_RUN([ main() { #if HAVE_CRYPT - char salt[30], answer[80]; - salt[0]='$'; salt[1]='5'; salt[2]='$'; salt[3]='$'; salt[4]='s'; salt[5]='a'; salt[6]='l'; salt[7]='t'; salt[8]='s'; salt[9]='t'; salt[10]='r'; salt[11]='i'; salt[12]='n'; salt[13]='g'; salt[14]='\0'; - strcat(salt,""); + char salt[21], answer[21+43]; + + strcpy(salt,"\$5\$rasmuslerdorf\$"); strcpy(answer, salt); - strcpy(&answer[29], "$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5"); - exit (strcmp((char *)crypt("foo",salt),answer)); + strcat(answer, "cFAm2puLCujQ9t.0CxiFIIvFi4JyQx5UncCt/xRIX23"); + exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer)); + #else exit(0); #endif diff --git a/php.ini-development b/php.ini-development index 43ab1de26a..93dc32da2e 100644 --- a/php.ini-development +++ b/php.ini-development @@ -197,13 +197,12 @@ engine = On ; This directive determines whether or not PHP will recognize code between -; <? and ?> tags as PHP source which should be processed as such. It's been -; recommended for several years that you not use the short tag "short cut" and -; instead to use the full <?php and ?> tag combination. With the wide spread use -; of XML and use of these tags by other languages, the server can become easily -; confused and end up parsing the wrong code in the wrong context. But because -; this short cut has been a feature for such a long time, it's currently still -; supported for backwards compatibility, but we recommend you don't use them. +; <? and ?> tags as PHP source which should be processed as such. It is +; generally recommended that <?php and ?> should be used and that this feature +; should be disabled, as enabling it may result in issues when generating XML +; documents, however this remains supported for backward compatibility reasons. +; Note that this directive does not control the <?= shorthand tag, which can be +; used regardless of this directive. ; Default Value: On ; Development Value: Off ; Production Value: Off diff --git a/php.ini-production b/php.ini-production index 0014c4e251..02a43790d2 100644 --- a/php.ini-production +++ b/php.ini-production @@ -197,13 +197,12 @@ engine = On ; This directive determines whether or not PHP will recognize code between -; <? and ?> tags as PHP source which should be processed as such. It's been -; recommended for several years that you not use the short tag "short cut" and -; instead to use the full <?php and ?> tag combination. With the wide spread use -; of XML and use of these tags by other languages, the server can become easily -; confused and end up parsing the wrong code in the wrong context. But because -; this short cut has been a feature for such a long time, it's currently still -; supported for backwards compatibility, but we recommend you don't use them. +; <? and ?> tags as PHP source which should be processed as such. It is +; generally recommended that <?php and ?> should be used and that this feature +; should be disabled, as enabling it may result in issues when generating XML +; documents, however this remains supported for backward compatibility reasons. +; Note that this directive does not control the <?= shorthand tag, which can be +; used regardless of this directive. ; Default Value: On ; Development Value: Off ; Production Value: Off diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index cbe9c7bd66..d50cc4f8a0 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -412,7 +412,7 @@ static void append_essential_headers(smart_str* buffer, php_cli_server_client *c { { char **val; - if (SUCCESS == zend_hash_find(&client->request.headers, "Host", sizeof("Host"), (void**)&val)) { + if (SUCCESS == zend_hash_find(&client->request.headers, "host", sizeof("host"), (void**)&val)) { smart_str_appendl_ex(buffer, "Host", sizeof("Host") - 1, persistent); smart_str_appendl_ex(buffer, ": ", sizeof(": ") - 1, persistent); smart_str_appends_ex(buffer, *val, persistent); @@ -568,7 +568,7 @@ static char *sapi_cli_server_read_cookies(TSRMLS_D) /* {{{ */ { php_cli_server_client *client = SG(server_context); char **val; - if (FAILURE == zend_hash_find(&client->request.headers, "Cookie", sizeof("Cookie"), (void**)&val)) { + if (FAILURE == zend_hash_find(&client->request.headers, "cookie", sizeof("cookie"), (void**)&val)) { return NULL; } return *val; @@ -1566,12 +1566,9 @@ static int php_cli_server_client_read_request_on_header_value(php_http_parser *p return 1; } { - char *header_name = client->current_header_name; - size_t header_name_len = client->current_header_name_len; - char c = header_name[header_name_len]; - header_name[header_name_len] = '\0'; - zend_hash_add(&client->request.headers, header_name, header_name_len + 1, &value, sizeof(char *), NULL); - header_name[header_name_len] = c; + char *header_name = zend_str_tolower_dup(client->current_header_name, client->current_header_name_len); + zend_hash_add(&client->request.headers, header_name, client->current_header_name_len + 1, &value, sizeof(char *), NULL); + efree(header_name); } if (client->current_header_name_allocated) { @@ -1729,7 +1726,7 @@ static void php_cli_server_client_populate_request_info(const php_cli_server_cli request_info->post_data = client->request.content; request_info->content_length = request_info->post_data_length = client->request.content_len; request_info->auth_user = request_info->auth_password = request_info->auth_digest = NULL; - if (SUCCESS == zend_hash_find(&client->request.headers, "Content-Type", sizeof("Content-Type"), (void**)&val)) { + if (SUCCESS == zend_hash_find(&client->request.headers, "content-type", sizeof("content-type"), (void**)&val)) { request_info->content_type = *val; } } /* }}} */ @@ -1967,7 +1964,7 @@ static int php_cli_server_begin_send_static(php_cli_server *server, php_cli_serv static int php_cli_server_request_startup(php_cli_server *server, php_cli_server_client *client TSRMLS_DC) { /* {{{ */ char **auth; php_cli_server_client_populate_request_info(client, &SG(request_info)); - if (SUCCESS == zend_hash_find(&client->request.headers, "Authorization", sizeof("Authorization"), (void**)&auth)) { + if (SUCCESS == zend_hash_find(&client->request.headers, "authorization", sizeof("authorization"), (void**)&auth)) { php_handle_auth_data(*auth TSRMLS_CC); } SG(sapi_headers).http_response_code = 200; diff --git a/sapi/cli/tests/bug65633.phpt b/sapi/cli/tests/bug65633.phpt new file mode 100644 index 0000000000..55834095b1 --- /dev/null +++ b/sapi/cli/tests/bug65633.phpt @@ -0,0 +1,48 @@ +--TEST-- +Bug #65633 (built-in server treat some http headers as case-sensitive) +--SKIPIF-- +<?php +include "skipif.inc"; +?> +--FILE-- +<?php +include "php_cli_server.inc"; +php_cli_server_start(<<<'PHP' +var_dump($_COOKIE, $_SERVER['HTTP_FOO']); +PHP +); + +list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); +$port = intval($port)?:80; + +$fp = fsockopen($host, $port, $errno, $errstr, 0.5); +if (!$fp) { + die("connect failed"); +} + +if(fwrite($fp, <<<HEADER +GET / HTTP/1.1 +cookie: foo=bar +foo: bar + + +HEADER +)) { + while (!feof($fp)) { + echo fgets($fp); + } +} + +fclose($fp); +?> +--EXPECTF-- +HTTP/1.1 200 OK +Connection: close +X-Powered-By: %s +Content-type: text/html + +array(1) { + ["foo"]=> + string(3) "bar" +} +string(3) "bar" |