Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ PHP NEWS
. Fixed bug GH-20426 (Spoofchecker::setRestrictionLevel() error message
suggests missing constants). (DanielEScherzer)

- Mbstring
. Fixed bug GH-20674 (Fix GH-20674 mb_decode_mimeheader does not handle
separator). (Yuya Hamada)

- Fibers:
. Fixed bug GH-20483 (ASAN stack overflow with fiber.stack_size INI
small value). (David Carlier)
Expand All @@ -26,6 +30,8 @@ PHP NEWS
. ini_set() with mbstring.detect_order changes the order of mb_detect_order
as intended, since mbstring.detect_order is an INI_ALL setting. (tobee94)
. Added GB18030-2022 to default encoding list for zh-CN. (HeRaNO)
. Fixed bug GH-20674 (Fix GH-20674 mb_decode_mimeheader does not handle
separator). (Yuya Hamada)

- Opcache:
. Fixed bug GH-20051 (apache2 shutdowns when restart is requested during
Expand All @@ -50,6 +56,10 @@ PHP NEWS
. Soap::__setCookie() when cookie name is a digit is now not stored and represented
as a string anymore but a int. (David Carlier)

- SPL:
. DirectoryIterator key can now work better with filesystem supporting larger
directory indexing. (David Carlier)

- Standard:
. Fixed bug GH-19926 (reset internal pointer earlier while splicing array
while COW violation flag is still set). (alexandre-daubois)
Expand Down
4 changes: 3 additions & 1 deletion ext/mbstring/mbstring.c
Original file line number Diff line number Diff line change
Expand Up @@ -6675,13 +6675,15 @@ static zend_string* mb_mime_header_decode(zend_string *input, const mbfl_encodin
p = temp;
/* Decoding of MIME encoded word was successful;
* Try to collapse a run of whitespace */
if (p < e && (*p == '\n' || *p == '\r')) {
if (p < e && (*p == '\n' || *p == '\r' || *p == '\t' || *p == ' ')) {
do {
p++;
} while (p < e && (*p == '\n' || *p == '\r' || *p == '\t' || *p == ' '));
/* We will only actually output a space if this is not immediately followed
* by another valid encoded word */
space_pending = true;
} else {
space_pending = false;
}
continue;
}
Expand Down
40 changes: 40 additions & 0 deletions ext/mbstring/tests/gh20674.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
--TEST--
GH-20674 (mb_decode_mimeheader does not handle separator)
--EXTENSIONS--
mbstring
--FILE--
<?php

$subject = '=?us-ascii?Q?The_PH?= =?us-ascii?Q?P_8.5?=';
var_dump(mb_decode_mimeheader($subject));

// mb_decode_mimeheader's backward compatible for TAB(\t)
$subject = "=?us-ascii?Q?The_PH?=\t=?us-ascii?Q?P_8.5?=";
var_dump(mb_decode_mimeheader($subject));

$subject = "=?us-ascii?Q?The_PH?=\t =?us-ascii?Q?P_8.5?=";
var_dump(mb_decode_mimeheader($subject));

$subject = "=?us-ascii?Q?The_PH?= \t =?us-ascii?Q?P_8.5?=";
var_dump(mb_decode_mimeheader($subject));

// from RFC 2047 https://www.ietf.org/rfc/rfc2047#section-8
var_dump(mb_decode_mimeheader("(=?ISO-8859-1?Q?a?=)"));
var_dump(mb_decode_mimeheader("(=?ISO-8859-1?Q?a?= b)"));
var_dump(mb_decode_mimeheader("(=?ISO-8859-1?Q?a_b?=)"));
var_dump(mb_decode_mimeheader("(=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)"));
var_dump(mb_decode_mimeheader("(=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)"));
var_dump(mb_decode_mimeheader("(=?ISO-8859-1?Q?a?=
=?ISO-8859-1?Q?b?=)"));
?>
--EXPECTF--
string(11) "The PHP 8.5"
string(11) "The PHP 8.5"
string(11) "The PHP 8.5"
string(11) "The PHP 8.5"
string(3) "(a)"
string(5) "(a b)"
string(5) "(a b)"
string(4) "(ab)"
string(4) "(ab)"
string(4) "(ab)"
2 changes: 1 addition & 1 deletion ext/spl/spl_directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ static zend_object *spl_filesystem_object_clone(zend_object *old_object)
spl_filesystem_dir_open(intern, source->path);
/* read until we hit the position in which we were before */
bool skip_dots = SPL_HAS_FLAG(source->flags, SPL_FILE_DIR_SKIPDOTS);
int index;
zend_long index;
for (index = 0; index < source->u.dir.index; ++index) {
do {
spl_filesystem_dir_read(intern);
Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_directory.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct _spl_filesystem_object {
struct {
php_stream *dirp;
zend_string *sub_path;
int index;
zend_long index;
zend_function *func_rewind;
zend_function *func_next;
zend_function *func_valid;
Expand Down
1 change: 1 addition & 0 deletions ext/sqlite3/sqlite3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2043,6 +2043,7 @@ PHP_METHOD(SQLite3Result, fetchArray)

default:
php_sqlite3_error(result_obj->db_obj, sqlite3_errcode(sqlite3_db_handle(result_obj->stmt_obj->stmt)), "Unable to execute statement: %s", sqlite3_errmsg(sqlite3_db_handle(result_obj->stmt_obj->stmt)));
RETURN_FALSE;
}
}
/* }}} */
Expand Down
14 changes: 14 additions & 0 deletions ext/sqlite3/tests/gh20699.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--TEST--
GH-20699 (SQLite3Result fetchArray return array|false, null returned)
--EXTENSIONS--
sqlite3
--CREDITS--
plusminmax
--FILE--
<?php
$db = new SQLite3(':memory:');
var_dump($db->prepare('BEGIN;')->execute()->fetchArray());
?>
--EXPECTF--
Warning: SQLite3Result::fetchArray(): Unable to execute statement: cannot start a transaction within a transaction in %s on line %d
bool(false)