Skip to content

Commit 36a0950

Browse files
committed
Merge remote-tracking branch 'origin/PHP-5.6' into str_size_and_int64_56_backport
* origin/PHP-5.6: (158 commits) fixed test updated NEWS updated NEWS Fixed bug #67118 DateTime constructor crash with invalid data update NEWS update NEWS add a test case previously broken by a bad fix Revert "Fixed bug #64604" updated libmagic.patch for 5.6+ updated libmagic.patch backport this piece from 5.6, related to the #66307 fix updated NEWS Fixed bug #66307 Fileinfo crashes with powerpoint files use a portable strndup implementation fixed C89 compat prepare config.w32 fix dll export add parser files to dist Fix accepting ill-formed UTF-8 characters sapi/litespeed/lsapi_main.c: Fix bug #63228 ... Conflicts: ext/date/php_date.c sapi/phpdbg/phpdbg_bp.c sapi/phpdbg/phpdbg_frame.c sapi/phpdbg/phpdbg_help.c sapi/phpdbg/phpdbg_list.c sapi/phpdbg/phpdbg_prompt.c
2 parents 70707a5 + 70fdb21 commit 36a0950

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+9072
-2204
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ sapi/fpm/php-fpm.1
246246
sapi/fpm/init.d.php-fpm
247247
sapi/fpm/php-fpm.conf
248248
sapi/fpm/fpm/php-cgi
249+
sapi/phpdbg/phpdbg_parser.c
250+
sapi/phpdbg/phpdbg_parser.h
249251
sapi/phpdbg/phpdbg
250252
scripts/php-config
251253
scripts/phpize

NEWS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ PHP NEWS
66
. Fixed bug #67079 (Missing MIME types for XML/XSL files). (Anatol)
77

88
- Core:
9-
. Fixed bug #64604 (parse_url is inconsistent with specified port).
10-
(Ingo Walz)
119
. Fixed bug #65701 (copy() doesn't work when destination filename is created
1210
by tempnam()). (Boro Sitnikovski)
1311
. Fixed bug #66015 (Unexpected array indexing in class's static property). (Bob)
@@ -29,6 +27,7 @@ PHP NEWS
2927
- Date:
3028
. Fixed bug #66721 (__wakeup of DateTime segfaults when invalid object data is
3129
supplied). (Boro Sitnikovski)
30+
. Fixed bug #67118 (DateTime constructor crash with invalid data). (Anatol)
3231

3332
- DOM:
3433
. Fixed bug #67081 (DOMDocumentType->internalSubset returns entire DOCTYPE tag,
@@ -37,6 +36,7 @@ PHP NEWS
3736
- Fileinfo:
3837
. Fixed bug #66907 (Solaris 10 is missing strcasestr and needs substitute).
3938
(Anatol)
39+
. Fixed bug #66307 (Fileinfo crashes with powerpoint files). (Anatol)
4040

4141
- FPM:
4242
. Fixed bug #66482 (unknown entry 'priority' in php-fpm.conf).

ext/date/php_date.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2716,7 +2716,9 @@ PHP_METHOD(DateTime, __construct)
27162716

27172717
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
27182718
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) {
2719-
php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC);
2719+
if (!php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC)) {
2720+
ZVAL_NULL(getThis());
2721+
}
27202722
}
27212723
zend_restore_error_handling(&error_handling TSRMLS_CC);
27222724
}

ext/date/tests/bug67118.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
Bug #67118 php-cgi crashes regularly on IIS 7
3+
--INI--
4+
date.timezone=Europe/Berlin
5+
--FILE--
6+
<?php
7+
class mydt extends datetime
8+
{
9+
public function __construct($time = 'now', $tz = NULL, $format = NULL)
10+
{
11+
if (!empty($tz) && !is_object($tz)) {
12+
$tz = new DateTimeZone($tz);
13+
}
14+
15+
@parent::__construct($time, $tz);
16+
}
17+
18+
};
19+
20+
new mydt("Funktionsansvarig rådgivning och juridik", "UTC");
21+
--EXPECTF--
22+
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Funktionsansvarig rådgivning och juridik) at position 0 (F): The timezone could not be found in the database' in %sbug67118.php:%d
23+
Stack trace:
24+
#0 %sbug67118.php(%d): DateTime->__construct('Funktionsansvar...', Object(DateTimeZone))
25+
#1 %sbug67118.php(%d): mydt->__construct('Funktionsansvar...', 'UTC')
26+
#2 {main}
27+
thrown in %sbug67118.php on line %d

ext/fileinfo/libmagic.patch

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2543,7 +2543,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
25432543
}
25442544
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
25452545
--- libmagic.orig/readcdf.c Tue Jan 7 04:13:42 2014
2546-
+++ libmagic/readcdf.c Fri Feb 21 00:21:27 2014
2546+
+++ libmagic/readcdf.c Thu Apr 24 20:07:51 2014
25472547
@@ -30,7 +30,11 @@
25482548
#endif
25492549

@@ -2567,7 +2567,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
25672567
private const char *
25682568
cdf_app_to_mime(const char *vbuf, const struct nv *nv)
25692569
{
2570-
@@ -91,7 +99,7 @@
2570+
@@ -91,12 +99,14 @@
25712571
{
25722572
size_t i;
25732573
cdf_timestamp_t tp;
@@ -2576,7 +2576,14 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
25762576
char buf[64];
25772577
const char *str = NULL;
25782578
const char *s;
2579-
@@ -162,8 +170,12 @@
2579+
int len;
2580+
2581+
+ memset(&ts, 0, sizeof(ts));
2582+
+
2583+
for (i = 0; i < count; i++) {
2584+
cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
2585+
switch (info[i].pi_type) {
2586+
@@ -162,8 +172,12 @@
25802587
case CDF_FILETIME:
25812588
tp = info[i].pi_tp;
25822589
if (tp != 0) {
@@ -2591,7 +2598,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
25912598
cdf_print_elapsed_time(tbuf,
25922599
sizeof(tbuf), tp);
25932600
if (NOTMIME(ms) && file_printf(ms,
2594-
@@ -171,8 +183,11 @@
2601+
@@ -171,8 +185,11 @@
25952602
return -1;
25962603
} else {
25972604
char *c, *ec;
@@ -3279,3 +3286,4 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
32793286
break;
32803287
}
32813288
case FILE_INDIRECT:
3289+

ext/fileinfo/libmagic/readcdf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
105105
const char *s;
106106
int len;
107107

108+
memset(&ts, 0, sizeof(ts));
109+
108110
for (i = 0; i < count; i++) {
109111
cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
110112
switch (info[i].pi_type) {

ext/fileinfo/tests/finfo_file_002.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ksort($results);
1818
var_dump($results);
1919
?>
2020
--EXPECTF--
21-
array(8) {
21+
array(9) {
2222
["%s/resources/dir.zip"]=>
2323
string(15) "application/zip"
2424
["%s/resources/test.awk"]=>
@@ -35,4 +35,6 @@ array(8) {
3535
string(15) "application/pdf"
3636
["%s/resources/test.png"]=>
3737
string(9) "image/png"
38+
["%s/resources/test.ppt"]=>
39+
string(29) "application/vnd.ms-powerpoint"
3840
}

ext/fileinfo/tests/resources/test.ppt

97.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)