Skip to content

Commit bbc738e

Browse files
authored
Declare ext/exif constants in stubs (#8680)
1 parent 8d79e66 commit bbc738e

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

ext/exif/exif.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
#define EXIFERR_CC
3838
#endif
3939

40+
#define USE_MBSTRING zend_hash_str_exists(&module_registry, "mbstring", sizeof("mbstring")-1)
41+
4042
#include "php_exif.h"
4143
#include "exif_arginfo.h"
4244
#include <math.h>
@@ -163,11 +165,9 @@ static PHP_GINIT_FUNCTION(exif)
163165
PHP_MINIT_FUNCTION(exif)
164166
{
165167
REGISTER_INI_ENTRIES();
166-
if (zend_hash_str_exists(&module_registry, "mbstring", sizeof("mbstring")-1)) {
167-
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT);
168-
} else {
169-
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT);
170-
}
168+
169+
register_exif_consts(module_number);
170+
171171
return SUCCESS;
172172
}
173173
/* }}} */

ext/exif/exif.stub.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
/** @generate-class-entries */
44

5+
/**
6+
* @var int
7+
* @cname USE_MBSTRING
8+
*/
9+
const EXIF_USE_MBSTRING = UNKNOWN;
10+
511
/** @refcount 1 */
612
function exif_tagname(int $index): string|false {}
713

ext/exif/exif_arginfo.h

Lines changed: 6 additions & 1 deletion
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: 22c3c385b3edc3e91b123e4c953d8836bf8eb7f3 */
2+
* Stub hash: 123192d967d2a1787c340a43238797323e878a1b */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_exif_tagname, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
@@ -37,3 +37,8 @@ static const zend_function_entry ext_functions[] = {
3737
ZEND_FE(exif_imagetype, arginfo_exif_imagetype)
3838
ZEND_FE_END
3939
};
40+
41+
static void register_exif_consts(int module_number)
42+
{
43+
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", USE_MBSTRING, CONST_CS | CONST_PERSISTENT);
44+
}

0 commit comments

Comments
 (0)