Skip to content

Commit b4b821e

Browse files
cataphractclaude
andcommitted
Fix extractCurrent absolute path detection on Windows
path[0] != '/' only catches Unix absolute paths. On Windows, absolute paths start with a drive letter (C:\) or UNC prefix (\\). Use PHP's IS_ABSOLUTE_PATH() macro which handles all cases on both platforms. Without this fix, setting $e->pathname to an absolute Windows path caused the CWD to be prepended, producing a garbage path that archive_write_header() silently failed to create. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4ee8f72 commit b4b821e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

libarchive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ PHP_METHOD(libarchive_Archive, extractCurrent)
279279
-1);
280280
return;
281281
}
282-
if (path[0] != '/') {
282+
if (!IS_ABSOLUTE_PATH(path, strlen(path))) {
283283
char cwd[MAXPATHLEN];
284284
char *result = VCWD_GETCWD(cwd, sizeof(cwd));
285285
if (!result) {

0 commit comments

Comments
 (0)