Skip to content

Declare ext/exif constants in stubs #8680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 1, 2022
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: 5 additions & 5 deletions ext/exif/exif.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#define EXIFERR_CC
#endif

#define USE_MBSTRING zend_hash_str_exists(&module_registry, "mbstring", sizeof("mbstring")-1)

#include "php_exif.h"
#include "exif_arginfo.h"
#include <math.h>
Expand Down Expand Up @@ -163,11 +165,9 @@ static PHP_GINIT_FUNCTION(exif)
PHP_MINIT_FUNCTION(exif)
{
REGISTER_INI_ENTRIES();
if (zend_hash_str_exists(&module_registry, "mbstring", sizeof("mbstring")-1)) {
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT);
} else {
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT);
}

register_exif_consts(module_number);

return SUCCESS;
}
/* }}} */
Expand Down
6 changes: 6 additions & 0 deletions ext/exif/exif.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

/** @generate-class-entries */

/**
* @var int
* @cname USE_MBSTRING
*/
const EXIF_USE_MBSTRING = UNKNOWN;

/** @refcount 1 */
function exif_tagname(int $index): string|false {}

Expand Down
7 changes: 6 additions & 1 deletion ext/exif/exif_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 22c3c385b3edc3e91b123e4c953d8836bf8eb7f3 */
* Stub hash: 123192d967d2a1787c340a43238797323e878a1b */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_exif_tagname, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
Expand Down Expand Up @@ -37,3 +37,8 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(exif_imagetype, arginfo_exif_imagetype)
ZEND_FE_END
};

static void register_exif_consts(int module_number)
{
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", USE_MBSTRING, CONST_CS | CONST_PERSISTENT);
}