Skip to content

Commit 4afea87

Browse files
committed
Merge branch 'renaming-parameter-names' of https://github.com/kamil-tekiela/php-src into renaming-parameter-names
2 parents 5fedc75 + 2967bfb commit 4afea87

Some content is hidden

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

62 files changed

+1071
-891
lines changed

UPGRADING

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,6 @@ PHP 8.0 UPGRADE NOTES
341341

342342
- LDAP:
343343
. The deprecated function ldap_sort has been removed.
344-
. The deprecated function ldap_control_paged_result has been removed.
345-
. The deprecated function ldap_control_paged_result_response has been removed.
346344
. The interface of ldap_set_rebind_proc has changed; the $callback parameter
347345
does not accept empty string anymore; null value shall be used instead.
348346

@@ -608,9 +606,6 @@ PHP 8.0 UPGRADE NOTES
608606
. Calling crypt() without an explicit salt is no longer supported. If you
609607
would like to produce a strong hash with an auto-generated salt, use
610608
password_hash() instead.
611-
. substr(), mb_substr(), iconv_substr() and grapheme_substr() now consistently
612-
clamp out-of-bounds offsets to the string boundary. Previously, false was
613-
returned instead of the empty string in some cases.
614609

615610
- Sysvmsg:
616611
. msg_get_queue() will now return an SysvMessageQueue object rather than a

Zend/tests/div_by_zero_in_static.phpt

Lines changed: 0 additions & 11 deletions
This file was deleted.

Zend/tests/instantiate_all_classes.phpt

Lines changed: 0 additions & 15 deletions
This file was deleted.

Zend/zend_operators.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,9 +1253,7 @@ ZEND_API zend_result ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *o
12531253
}
12541254
/* }}} */
12551255

1256-
/* Returns SUCCESS/FAILURE/TYPES_NOT_HANDLED */
1257-
#define TYPES_NOT_HANDLED 1
1258-
static int ZEND_FASTCALL div_function_base(zval *result, zval *op1, zval *op2) /* {{{ */
1256+
static zend_result ZEND_FASTCALL div_function_base(zval *result, zval *op1, zval *op2) /* {{{ */
12591257
{
12601258
zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2));
12611259

@@ -1292,25 +1290,23 @@ static int ZEND_FASTCALL div_function_base(zval *result, zval *op1, zval *op2) /
12921290
ZVAL_DOUBLE(result, (double)Z_LVAL_P(op1) / Z_DVAL_P(op2));
12931291
return SUCCESS;
12941292
} else {
1295-
return TYPES_NOT_HANDLED;
1293+
return FAILURE;
12961294
}
12971295
division_by_0:
12981296
if (result != op1) {
12991297
ZVAL_UNDEF(result);
13001298
}
13011299
zend_throw_error(zend_ce_division_by_zero_error, "Division by zero");
1302-
return FAILURE;
1300+
return SUCCESS;
13031301
}
13041302
/* }}} */
13051303

13061304
ZEND_API zend_result ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* {{{ */
13071305
{
13081306
ZVAL_DEREF(op1);
13091307
ZVAL_DEREF(op2);
1310-
1311-
int retval = div_function_base(result, op1, op2);
1312-
if (retval != TYPES_NOT_HANDLED) {
1313-
return retval;
1308+
if (div_function_base(result, op1, op2) == SUCCESS) {
1309+
return SUCCESS;
13141310
}
13151311

13161312
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_DIV);
@@ -1329,9 +1325,12 @@ ZEND_API zend_result ZEND_FASTCALL div_function(zval *result, zval *op1, zval *o
13291325
zval_ptr_dtor(result);
13301326
}
13311327

1332-
retval = div_function_base(result, &op1_copy, &op2_copy);
1333-
ZEND_ASSERT(retval != TYPES_NOT_HANDLED && "Types should be handled");
1334-
return retval;
1328+
if (div_function_base(result, &op1_copy, &op2_copy) == SUCCESS) {
1329+
return SUCCESS;
1330+
}
1331+
1332+
ZEND_ASSERT(0 && "Operation must succeed");
1333+
return FAILURE;
13351334
}
13361335
/* }}} */
13371336

build/gen_stub.php

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ function processStubFile(string $stubFile, Context $context) {
3131
throw new Exception("File $stubFile does not exist");
3232
}
3333

34-
$arginfoFile = str_replace('.stub.php', '', $stubFile)
35-
. ($context->legacy ? '_legacy' : '') . '_arginfo.h';
34+
$arginfoFile = str_replace('.stub.php', '', $stubFile) . '_arginfo.h';
3635
$stubCode = file_get_contents($stubFile);
3736
$stubHash = computeStubHash($stubCode);
3837
$oldStubHash = extractStubHash($arginfoFile);
@@ -43,12 +42,6 @@ function processStubFile(string $stubFile, Context $context) {
4342

4443
initPhpParser();
4544
$fileInfo = parseStubFile($stubCode);
46-
if ($context->legacy) {
47-
foreach ($fileInfo->getAllFuncInfos() as $funcInfo) {
48-
$funcInfo->discardInfoForOldPhpVersions();
49-
}
50-
}
51-
5245
$arginfoCode = generateArgInfoCode($fileInfo, $stubHash);
5346
file_put_contents($arginfoFile, $arginfoCode);
5447

@@ -595,14 +588,6 @@ private function getFlagsAsString(): string
595588

596589
return $flags;
597590
}
598-
599-
public function discardInfoForOldPhpVersions(): void {
600-
$this->return->type = null;
601-
foreach ($this->args as $arg) {
602-
$arg->type = null;
603-
$arg->defaultValue = null;
604-
}
605-
}
606591
}
607592

608593
class ClassInfo {
@@ -1220,11 +1205,10 @@ function initPhpParser() {
12201205
}
12211206

12221207
$optind = null;
1223-
$options = getopt("f", ["force-regeneration", "parameter-stats", "legacy"], $optind);
1208+
$options = getopt("f", ["force-regeneration", "parameter-stats"], $optind);
12241209

12251210
$context = new Context;
12261211
$printParameterStats = isset($options["parameter-stats"]);
1227-
$context->legacy = isset($options["legacy"]);
12281212
$context->forceRegeneration =
12291213
isset($options["f"]) || isset($options["force-regeneration"]) || $printParameterStats;
12301214

ext/curl/interface.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3308,12 +3308,6 @@ static void curl_free_obj(zend_object *object)
33083308
fprintf(stderr, "DTOR CALLED, ch = %x\n", ch);
33093309
#endif
33103310

3311-
if (!ch->cp) {
3312-
/* Can happen if constructor throws. */
3313-
zend_object_std_dtor(&ch->std);
3314-
return;
3315-
}
3316-
33173311
_php_curl_verify_handlers(ch, 0);
33183312

33193313
/*
@@ -3327,10 +3321,12 @@ static void curl_free_obj(zend_object *object)
33273321
*
33283322
* Libcurl commit d021f2e8a00 fix this issue and should be part of 7.28.2
33293323
*/
3330-
curl_easy_setopt(ch->cp, CURLOPT_HEADERFUNCTION, curl_write_nothing);
3331-
curl_easy_setopt(ch->cp, CURLOPT_WRITEFUNCTION, curl_write_nothing);
3324+
if (ch->cp != NULL) {
3325+
curl_easy_setopt(ch->cp, CURLOPT_HEADERFUNCTION, curl_write_nothing);
3326+
curl_easy_setopt(ch->cp, CURLOPT_WRITEFUNCTION, curl_write_nothing);
33323327

3333-
curl_easy_cleanup(ch->cp);
3328+
curl_easy_cleanup(ch->cp);
3329+
}
33343330

33353331
/* cURL destructors should be invoked only by last curl handle */
33363332
if (--(*ch->clone) == 0) {

ext/curl/multi.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -537,12 +537,6 @@ void curl_multi_free_obj(zend_object *object)
537537
php_curl *ch;
538538
zval *pz_ch;
539539

540-
if (!mh->multi) {
541-
/* Can happen if constructor throws. */
542-
zend_object_std_dtor(&mh->std);
543-
return;
544-
}
545-
546540
for (pz_ch = (zval *)zend_llist_get_first_ex(&mh->easyh, &pos); pz_ch;
547541
pz_ch = (zval *)zend_llist_get_next_ex(&mh->easyh, &pos)) {
548542
if (!(OBJ_FLAGS(Z_OBJ_P(pz_ch)) & IS_OBJ_FREE_CALLED)) {

ext/curl/tests/bug80121.phpt

Lines changed: 0 additions & 26 deletions
This file was deleted.

ext/enchant/enchant.stub.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ function enchant_broker_free(EnchantBroker $broker): bool {}
1818
function enchant_broker_get_error(EnchantBroker $broker): string|false {}
1919

2020
/** @deprecated */
21-
function enchant_broker_set_dict_path(EnchantBroker $broker, int $type, string $path): bool {}
21+
function enchant_broker_set_dict_path(EnchantBroker $broker, int $name, string $value): bool {}
2222

2323
/** @deprecated */
24-
function enchant_broker_get_dict_path(EnchantBroker $broker, int $type): string|false {}
24+
function enchant_broker_get_dict_path(EnchantBroker $broker, int $name): string|false {}
2525

2626
function enchant_broker_list_dicts(EnchantBroker $broker): array {}
2727

@@ -30,7 +30,7 @@ function enchant_broker_request_dict(EnchantBroker $broker, string $tag): Enchan
3030
function enchant_broker_request_pwl_dict(EnchantBroker $broker, string $filename): EnchantDictionary|false {}
3131

3232
/** @deprecated */
33-
function enchant_broker_free_dict(EnchantDictionary $dictionary): bool {}
33+
function enchant_broker_free_dict(EnchantDictionary $dict): bool {}
3434

3535
function enchant_broker_dict_exists(EnchantBroker $broker, string $tag): bool {}
3636

@@ -39,32 +39,32 @@ function enchant_broker_set_ordering(EnchantBroker $broker, string $tag, string
3939
function enchant_broker_describe(EnchantBroker $broker): array {}
4040

4141
/** @param array $suggestions */
42-
function enchant_dict_quick_check(EnchantDictionary $dictionary, string $word, &$suggestions = null): bool {}
42+
function enchant_dict_quick_check(EnchantDictionary $dict, string $word, &$suggestions = null): bool {}
4343

44-
function enchant_dict_check(EnchantDictionary $dictionary, string $word): bool {}
44+
function enchant_dict_check(EnchantDictionary $dict, string $word): bool {}
4545

46-
function enchant_dict_suggest(EnchantDictionary $dictionary, string $word): array {}
46+
function enchant_dict_suggest(EnchantDictionary $dict, string $word): array {}
4747

48-
function enchant_dict_add(EnchantDictionary $dictionary, string $word): void {}
48+
function enchant_dict_add(EnchantDictionary $dict, string $word): void {}
4949

5050
/**
5151
* @alias enchant_dict_add
5252
* @deprecated
5353
*/
54-
function enchant_dict_add_to_personal(EnchantDictionary $dictionary, string $word): void {}
54+
function enchant_dict_add_to_personal(EnchantDictionary $dict, string $word): void {}
5555

56-
function enchant_dict_add_to_session(EnchantDictionary $dictionary, string $word): void {}
56+
function enchant_dict_add_to_session(EnchantDictionary $dict, string $word): void {}
5757

58-
function enchant_dict_is_added(EnchantDictionary $dictionary, string $word): bool {}
58+
function enchant_dict_is_added(EnchantDictionary $dict, string $word): bool {}
5959

6060
/**
6161
* @alias enchant_dict_is_added
6262
* @deprecated
6363
*/
64-
function enchant_dict_is_in_session(EnchantDictionary $dictionary, string $word): bool {}
64+
function enchant_dict_is_in_session(EnchantDictionary $dict, string $word): bool {}
6565

66-
function enchant_dict_store_replacement(EnchantDictionary $dictionary, string $misspelled, string $correct): void {}
66+
function enchant_dict_store_replacement(EnchantDictionary $dict, string $mis, string $cor): void {}
6767

68-
function enchant_dict_get_error(EnchantDictionary $dictionary): string|false {}
68+
function enchant_dict_get_error(EnchantDictionary $dict): string|false {}
6969

70-
function enchant_dict_describe(EnchantDictionary $dictionary): array {}
70+
function enchant_dict_describe(EnchantDictionary $dict): array {}

ext/enchant/enchant_arginfo.h

Lines changed: 14 additions & 14 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: 31f7c4cd39e58d6474b90acd65f4b7bda7a6ddf3 */
2+
* Stub hash: 22c47f0b30f6952a42546c403fbd2e92836661fa */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_enchant_broker_init, 0, 0, EnchantBroker, MAY_BE_FALSE)
55
ZEND_END_ARG_INFO()
@@ -14,13 +14,13 @@ ZEND_END_ARG_INFO()
1414

1515
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_set_dict_path, 0, 3, _IS_BOOL, 0)
1616
ZEND_ARG_OBJ_INFO(0, broker, EnchantBroker, 0)
17-
ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
18-
ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
17+
ZEND_ARG_TYPE_INFO(0, name, IS_LONG, 0)
18+
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
1919
ZEND_END_ARG_INFO()
2020

2121
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_enchant_broker_get_dict_path, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
2222
ZEND_ARG_OBJ_INFO(0, broker, EnchantBroker, 0)
23-
ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
23+
ZEND_ARG_TYPE_INFO(0, name, IS_LONG, 0)
2424
ZEND_END_ARG_INFO()
2525

2626
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_list_dicts, 0, 1, IS_ARRAY, 0)
@@ -38,7 +38,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_enchant_broker_request_pwl_d
3838
ZEND_END_ARG_INFO()
3939

4040
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_free_dict, 0, 1, _IS_BOOL, 0)
41-
ZEND_ARG_OBJ_INFO(0, dictionary, EnchantDictionary, 0)
41+
ZEND_ARG_OBJ_INFO(0, dict, EnchantDictionary, 0)
4242
ZEND_END_ARG_INFO()
4343

4444
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_dict_exists, 0, 2, _IS_BOOL, 0)
@@ -55,23 +55,23 @@ ZEND_END_ARG_INFO()
5555
#define arginfo_enchant_broker_describe arginfo_enchant_broker_list_dicts
5656

5757
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_quick_check, 0, 2, _IS_BOOL, 0)
58-
ZEND_ARG_OBJ_INFO(0, dictionary, EnchantDictionary, 0)
58+
ZEND_ARG_OBJ_INFO(0, dict, EnchantDictionary, 0)
5959
ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
6060
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, suggestions, "null")
6161
ZEND_END_ARG_INFO()
6262

6363
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_check, 0, 2, _IS_BOOL, 0)
64-
ZEND_ARG_OBJ_INFO(0, dictionary, EnchantDictionary, 0)
64+
ZEND_ARG_OBJ_INFO(0, dict, EnchantDictionary, 0)
6565
ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
6666
ZEND_END_ARG_INFO()
6767

6868
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_suggest, 0, 2, IS_ARRAY, 0)
69-
ZEND_ARG_OBJ_INFO(0, dictionary, EnchantDictionary, 0)
69+
ZEND_ARG_OBJ_INFO(0, dict, EnchantDictionary, 0)
7070
ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
7171
ZEND_END_ARG_INFO()
7272

7373
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_add, 0, 2, IS_VOID, 0)
74-
ZEND_ARG_OBJ_INFO(0, dictionary, EnchantDictionary, 0)
74+
ZEND_ARG_OBJ_INFO(0, dict, EnchantDictionary, 0)
7575
ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
7676
ZEND_END_ARG_INFO()
7777

@@ -84,17 +84,17 @@ ZEND_END_ARG_INFO()
8484
#define arginfo_enchant_dict_is_in_session arginfo_enchant_dict_check
8585

8686
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_store_replacement, 0, 3, IS_VOID, 0)
87-
ZEND_ARG_OBJ_INFO(0, dictionary, EnchantDictionary, 0)
88-
ZEND_ARG_TYPE_INFO(0, misspelled, IS_STRING, 0)
89-
ZEND_ARG_TYPE_INFO(0, correct, IS_STRING, 0)
87+
ZEND_ARG_OBJ_INFO(0, dict, EnchantDictionary, 0)
88+
ZEND_ARG_TYPE_INFO(0, mis, IS_STRING, 0)
89+
ZEND_ARG_TYPE_INFO(0, cor, IS_STRING, 0)
9090
ZEND_END_ARG_INFO()
9191

9292
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_enchant_dict_get_error, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
93-
ZEND_ARG_OBJ_INFO(0, dictionary, EnchantDictionary, 0)
93+
ZEND_ARG_OBJ_INFO(0, dict, EnchantDictionary, 0)
9494
ZEND_END_ARG_INFO()
9595

9696
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_describe, 0, 1, IS_ARRAY, 0)
97-
ZEND_ARG_OBJ_INFO(0, dictionary, EnchantDictionary, 0)
97+
ZEND_ARG_OBJ_INFO(0, dict, EnchantDictionary, 0)
9898
ZEND_END_ARG_INFO()
9999

100100

ext/exif/exif.stub.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
function exif_tagname(int $index): string|false {}
66

7-
/** @param resource|string $file */
8-
function exif_read_data($file, ?string $required_sections = null, bool $as_arrays = false, bool $read_thumbnail = false): array|false {}
7+
/** @param resource|string $filename */
8+
function exif_read_data($filename, ?string $sections_needed = null, bool $sub_arrays = false, bool $read_thumbnail = false): array|false {}
99

1010
/**
11-
* @param resource|string $file
11+
* @param resource|string $filename
1212
* @param int $width
1313
* @param int $height
14-
* @param int $image_type
14+
* @param int $imagetype
1515
*/
16-
function exif_thumbnail($file, &$width = null, &$height = null, &$image_type = null): string|false {}
16+
function exif_thumbnail($filename, &$width = null, &$height = null, &$imagetype = null): string|false {}
1717

1818
function exif_imagetype(string $filename): int|false {}

0 commit comments

Comments
 (0)