Skip to content

Commit c37a1cd

Browse files
committed
Promote a few remaining errors in ext/standard
Closes GH-6110
1 parent 62c20c6 commit c37a1cd

Some content is hidden

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

64 files changed

+1222
-1072
lines changed

Zend/tests/bug41026.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ echo "Done\n";
2323
--EXPECT--
2424
Done
2525

26-
Warning: (Registered shutdown functions) Unable to call self::on_shutdown() - function does not exist in Unknown on line 0
26+
Fatal error: Registered shutdown function self::on_shutdown() cannot be called, function does not exist in Unknown on line 0

ext/mbstring/mbstring.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2233,8 +2233,7 @@ PHP_FUNCTION(mb_strcut)
22332233
}
22342234

22352235
if (from > string.len) {
2236-
// TODO Out of bounds ValueError
2237-
RETURN_FALSE;
2236+
RETURN_EMPTY_STRING();
22382237
}
22392238

22402239
ret = mbfl_strcut(&string, &result, from, len);
@@ -3500,6 +3499,9 @@ PHP_FUNCTION(mb_send_mail)
35003499
str_headers = php_trim(str_headers, NULL, 0, 2);
35013500
} else if (headers_ht) {
35023501
str_headers = php_mail_build_headers(headers_ht);
3502+
if (EG(exception)) {
3503+
RETURN_THROWS();
3504+
}
35033505
}
35043506

35053507
zend_hash_init(&ht_headers, 0, NULL, ZVAL_PTR_DTOR, 0);

ext/mbstring/mbstring.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function mb_substr_count(string $haystack, string $needle, ?string $encoding = n
4545

4646
function mb_substr(string $str, int $start, ?int $length = null, ?string $encoding = null): string {}
4747

48-
function mb_strcut(string $str, int $start, ?int $length = null, ?string $encoding = null): string|false {}
48+
function mb_strcut(string $str, int $start, ?int $length = null, ?string $encoding = null): string {}
4949

5050
function mb_strwidth(string $str, ?string $encoding = null): int {}
5151

ext/mbstring/mbstring_arginfo.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 442b9dc473714c91663fcd530214935ba74302e4 */
2+
* Stub hash: e02a0588d1f46fa96452558e35ea904907b8bdf2 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_language, 0, 0, MAY_BE_STRING|MAY_BE_BOOL)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, language, IS_STRING, 1, "null")
@@ -87,12 +87,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_substr, 0, 2, IS_STRING, 0)
8787
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
8888
ZEND_END_ARG_INFO()
8989

90-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_strcut, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
91-
ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
92-
ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
93-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
94-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
95-
ZEND_END_ARG_INFO()
90+
#define arginfo_mb_strcut arginfo_mb_substr
9691

9792
#define arginfo_mb_strwidth arginfo_mb_strlen
9893

ext/mbstring/tests/bug49354.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ var_dump(mb_strcut($crap, 2, 100, 'UTF-8'));
1111
var_dump(mb_strcut($crap, 3, 100, 'UTF-8'));
1212
var_dump(mb_strcut($crap, 12, 100, 'UTF-8'));
1313
var_dump(mb_strcut($crap, 13, 100, 'UTF-8'));
14+
1415
?>
1516
--EXPECT--
1617
string(12) "AåBäCöDü"
1718
string(11) "åBäCöDü"
1819
string(11) "åBäCöDü"
1920
string(9) "BäCöDü"
2021
string(0) ""
21-
bool(false)
22+
string(0) ""

ext/mbstring/tests/mb_strcut.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ print MBStringChars(mb_strcut($euc_jp, 5, 5,'EUC-JP'), 'EUC-JP') . "\n";
2929
print MBStringChars(mb_strcut($euc_jp, 0, 100,'EUC-JP'), 'EUC-JP') . "\n";
3030

3131
$str = mb_strcut($euc_jp, 100, 10,'EUC-JP');
32-
($str === false) ? print "OK\n" : print "No good\n";
32+
($str === "") ? print "OK\n" : print "No good\n";
3333

3434
$str = mb_strcut($euc_jp, -100, 10,'EUC-JP');
3535
($str !== "") ? print "OK\n" : print "No good\n";
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--TEST--
2+
mysqli_real_connect() with compression
3+
--SKIPIF--
4+
<?php
5+
require_once('skipif.inc');
6+
require_once('skipifemb.inc');
7+
require_once('skipifconnectfailure.inc');
8+
?>
9+
--INI--
10+
mysqli.allow_local_infile=1
11+
--FILE--
12+
<?php
13+
14+
include("connect.inc");
15+
16+
$mysqli = mysqli_init();
17+
$result = my_mysqli_real_connect($mysqli, $host, $user, $passwd, "", $port, $socket, MYSQLI_CLIENT_COMPRESS);
18+
19+
$mysqli->query("DROP TABLE IF EXISTS test");
20+
$create = "CREATE TABLE test (blob BLOB NOT NULL DEFAULT '')";
21+
22+
$data = str_repeat("x", 16 * 1024 * 1024);
23+
$mysqli->query("INSERT INTO test(`blob`) VALUE ('$data')");
24+
25+
var_dump(mysqli_error_list($mysqli));
26+
$mysqli->close();
27+
28+
?>
29+
--CLEAN--
30+
<?php
31+
require_once("clean_table.inc");
32+
?>
33+
--EXPECT--

ext/opcache/Optimizer/zend_func_info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ static const func_info_t func_infos[] = {
533533
F1("mb_stristr", MAY_BE_FALSE | MAY_BE_STRING),
534534
F1("mb_strrichr", MAY_BE_FALSE | MAY_BE_STRING),
535535
F1("mb_substr", MAY_BE_STRING),
536-
F1("mb_strcut", MAY_BE_FALSE | MAY_BE_STRING),
536+
F1("mb_strcut", MAY_BE_STRING),
537537
F1("mb_strimwidth", MAY_BE_STRING),
538538
F1("mb_convert_encoding", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
539539
F1("mb_detect_encoding", MAY_BE_FALSE | MAY_BE_STRING),

ext/sodium/libsodium.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3067,7 +3067,7 @@ PHP_FUNCTION(sodium_unpad)
30673067
RETURN_THROWS();
30683068
}
30693069
if (padded_len < blocksize) {
3070-
zend_argument_error(sodium_exception_ce, 1, "must not be shorter than the block size");
3070+
zend_argument_error(sodium_exception_ce, 1, "must be at least as long as the block size");
30713071
RETURN_THROWS();
30723072
}
30733073

ext/standard/array.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -962,22 +962,6 @@ static int php_array_user_compare(Bucket *a, Bucket *b) /* {{{ */
962962
}
963963
/* }}} */
964964

965-
/* check if comparison function is valid */
966-
#define PHP_ARRAY_CMP_FUNC_CHECK(func_name) \
967-
if (!zend_is_callable(*func_name, 0, NULL)) { \
968-
php_error_docref(NULL, E_WARNING, "Invalid comparison function"); \
969-
BG(user_compare_fci) = old_user_compare_fci; \
970-
BG(user_compare_fci_cache) = old_user_compare_fci_cache; \
971-
RETURN_FALSE; \
972-
} \
973-
974-
/* Clear FCI cache otherwise : for example the same or other array with
975-
* (partly) the same key values has been sorted with uasort() or
976-
* other sorting function the comparison is cached, however the name
977-
* of the function for comparison is not respected. see bug #28739 AND #33295
978-
*
979-
* Following defines will assist in backup / restore values. */
980-
981965
#define PHP_ARRAY_CMP_FUNC_VARS \
982966
zend_fcall_info old_user_compare_fci; \
983967
zend_fcall_info_cache old_user_compare_fci_cache \
@@ -2567,7 +2551,7 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu
25672551
zend_hash_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data);
25682552
}
25692553
} else {
2570-
php_error_docref(NULL, E_NOTICE, "Undefined variable $%s", ZSTR_VAL(Z_STR_P(entry)));
2554+
php_error_docref(NULL, E_WARNING, "Undefined variable $%s", ZSTR_VAL(Z_STR_P(entry)));
25712555
}
25722556
} else if (Z_TYPE_P(entry) == IS_ARRAY) {
25732557
if (Z_REFCOUNTED_P(entry)) {

0 commit comments

Comments
 (0)