Skip to content

Commit 8c6d006

Browse files
committed
Fix #79557: extension_dir = ./ext now use current directory for base
For some reason, `ImageLoad()` fails to load images with a relative path starting with `.\` or `./`. We work around this issue by stripping those leading characters.
1 parent 844a124 commit 8c6d006

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ PHP NEWS
77
called). (Laruence)
88
. Fixed bug #79566 (Private SHM is not private on Windows). (cmb)
99
. Fixed bug #79489 (.user.ini does not inherit). (cmb)
10+
. Fixed bug #79557 (extension_dir = ./ext now use current directory for
11+
base). (cmb)
1012

1113
- FFI:
1214
. Fixed bug #79571 (FFI: var_dumping unions may segfault). (cmb)

win32/winutil.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,13 @@ PHP_WINUTIL_API char *php_win32_get_username(void)
440440

441441
static zend_always_inline BOOL is_compatible(const char *name, BOOL is_smaller, char *format, char **err)
442442
{/*{{{*/
443-
PLOADED_IMAGE img = ImageLoad(name, NULL);
443+
/* work around ImageLoad() issue */
444+
char *name_stripped = name;
445+
if (name[0] == '.' && IS_SLASH(name[1])) {
446+
name_stripped += 2;
447+
}
448+
449+
PLOADED_IMAGE img = ImageLoad(name_stripped, NULL);
444450

445451
if (!img) {
446452
DWORD _err = GetLastError();

0 commit comments

Comments
 (0)