Skip to content

Commit 9b63d3d

Browse files
committed
Merged pull request xdebug#1040
* pr/1040: Fixed issue #2372: PHP 8.5: Changes to glob interface Split xdebug_normalize_path_* into their own file Build Xdebug 3.5 on PHP 8.5 on Windows in CI
2 parents ba5c896 + 83b4e5a commit 9b63d3d

File tree

10 files changed

+112
-12
lines changed

10 files changed

+112
-12
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
id: extension-matrix
2424
uses: php/php-windows-builder/extension-matrix@v1
2525
with:
26-
php-version-list: '8.0, 8.1, 8.2, 8.3, 8.4'
26+
php-version-list: '8.0, 8.1, 8.2, 8.3, 8.4, 8.5'
2727
arch-list: 'x64'
2828

2929
windows:

config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ if test "$PHP_XDEBUG" != "no"; then
108108
PHP_XDEBUG_CFLAGS="$STD_CFLAGS $MAINTAINER_CFLAGS"
109109

110110
XDEBUG_BASE_SOURCES="src/base/base.c src/base/ctrl_socket.c src/base/filter.c"
111-
XDEBUG_LIB_SOURCES="src/lib/usefulstuff.c src/lib/cmd_parser.c src/lib/compat.c src/lib/crc32.c src/lib/file.c src/lib/hash.c src/lib/headers.c src/lib/lib.c src/lib/llist.c src/lib/log.c src/lib/set.c src/lib/str.c src/lib/timing.c src/lib/trim.c src/lib/var.c src/lib/var_export_html.c src/lib/var_export_line.c src/lib/var_export_text.c src/lib/var_export_xml.c src/lib/xdebug_strndup.c src/lib/xml.c"
111+
XDEBUG_LIB_SOURCES="src/lib/usefulstuff.c src/lib/cmd_parser.c src/lib/compat.c src/lib/crc32.c src/lib/file.c src/lib/hash.c src/lib/headers.c src/lib/lib.c src/lib/llist.c src/lib/log.c src/lib/normalize_path.c src/lib/set.c src/lib/str.c src/lib/timing.c src/lib/trim.c src/lib/var.c src/lib/var_export_html.c src/lib/var_export_line.c src/lib/var_export_text.c src/lib/var_export_xml.c src/lib/xdebug_strndup.c src/lib/xml.c"
112112
XDEBUG_LIB_MAPS_SOURCES="src/lib/maps/maps.c src/lib/maps/maps_private.c src/lib/maps/parser.c"
113113

114114
XDEBUG_COVERAGE_SOURCES="src/coverage/branch_info.c src/coverage/code_coverage.c"

config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ARG_WITH("xdebug-compression", "whether to compress profiler files (requires zli
66

77
if (PHP_XDEBUG != 'no') {
88
var XDEBUG_BASE_SOURCES="base.c filter.c ctrl_socket.c"
9-
var XDEBUG_LIB_SOURCES="usefulstuff.c cmd_parser.c compat.c crc32.c file.c hash.c headers.c lib.c llist.c log.c set.c str.c timing.c trim.c var.c var_export_html.c var_export_line.c var_export_text.c var_export_xml.c xdebug_strndup.c xml.c"
9+
var XDEBUG_LIB_SOURCES="usefulstuff.c cmd_parser.c compat.c crc32.c file.c hash.c headers.c lib.c llist.c log.c normalize_path.c set.c str.c timing.c trim.c var.c var_export_html.c var_export_line.c var_export_text.c var_export_xml.c xdebug_strndup.c xml.c"
1010
var XDEBUG_LIB_MAPS_SOURCES="maps.c maps_private.c parser.c"
1111

1212
var XDEBUG_COVERAGE_SOURCES="branch_info.c code_coverage.c"

package.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ Tue, Oct 07, 2025 - Xdebug 3.5.0alpha2
133133
<file name="llist.c" role="src" />
134134
<file name="llist.h" role="src" />
135135
<file name="mm.h" role="src" />
136+
<file name="normalize_path.c" role="src" />
137+
<file name="normalize_path.h" role="src" />
136138
<file name="php-header.h" role="src" />
137139
<file name="set.c" role="src" />
138140
<file name="set.h" role="src" />

src/lib/maps/maps.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
#include <stddef.h>
1717
#include <stdlib.h>
1818

19+
#ifndef XDEBUG_NO_PHP_FEATURES
20+
# include "php_xdebug.h"
21+
#endif
22+
1923
#if PHP_VERSION_ID >= 80500
2024
# include "php_glob.h"
2125
# define xdebug_glob php_glob
@@ -33,7 +37,9 @@
3337
# define xdebug_globfree globfree
3438
#endif
3539

36-
#include "php_xdebug.h"
40+
#ifndef PHP_GLOB_NOMATCH
41+
# define PHP_GLOB_NOMATCH GLOB_NOMATCH
42+
#endif
3743

3844
#include "maps_private.h"
3945
#include "parser.h"
@@ -85,7 +91,7 @@ static void scan_directory(const char *dir)
8591
case 0: /* No error */
8692
break;
8793

88-
case GLOB_NOMATCH:
94+
case PHP_GLOB_NOMATCH:
8995
xdebug_log_ex(XLOG_CHAN_PATHMAP, XLOG_DEBUG, "NOMATCH", "No map files found with pattern '%s'", scan_dir);
9096
xdfree(scan_dir);
9197

src/lib/maps/maps_private.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
#include "maps_private.h"
2121
#include "../mm.h"
22+
#include "../normalize_path.h"
2223
#include "../strrnchr.h"
23-
#include "../usefulstuff.h"
2424
#include "../vector.h"
2525
#include "../xdebug_strndup.h"
2626

src/lib/maps/parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
#include "../hash.h"
2727
#include "../mm.h"
28+
#include "../normalize_path.h"
2829
#include "../str.h"
2930
#include "../trim.h"
30-
#include "../usefulstuff.h"
3131
#include "../xdebug_strndup.h"
3232

3333
typedef struct path_maps_parser_state {

src/lib/normalize_path.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
+----------------------------------------------------------------------+
3+
| Xdebug |
4+
+----------------------------------------------------------------------+
5+
| Copyright (c) 2002-2025 Derick Rethans |
6+
+----------------------------------------------------------------------+
7+
| This source file is subject to version 1.01 of the Xdebug license, |
8+
| that is bundled with this package in the file LICENSE, and is |
9+
| available at through the world-wide-web at |
10+
| https://xdebug.org/license.php |
11+
| If you did not receive a copy of the Xdebug license and are unable |
12+
| to obtain it through the world-wide-web, please send a note to |
13+
| [email protected] so we can mail you a copy immediately. |
14+
+----------------------------------------------------------------------+
15+
*/
16+
17+
#include <string.h>
18+
19+
#include "mm.h"
20+
#include "str.h"
21+
22+
#ifdef PHP_WIN32
23+
char *xdebug_normalize_path_char(const char *path)
24+
{
25+
char *new_path = xdstrdup(path);
26+
char *ptr = new_path;
27+
28+
do {
29+
if ((*ptr) == '\\') {
30+
*ptr = '/';
31+
}
32+
ptr++;
33+
} while (*ptr != '\0');
34+
35+
return new_path;
36+
}
37+
38+
void xdebug_normalize_path_xdebug_str_in_place(xdebug_str *path)
39+
{
40+
int i;
41+
42+
for (i = 0; i < XDEBUG_STR_LEN(path); i++) {
43+
if (XDEBUG_STR_VAL(path)[i] == '\\') {
44+
XDEBUG_STR_VAL(path)[i] = '/';
45+
}
46+
}
47+
}
48+
#else
49+
char *xdebug_normalize_path_char(const char *path)
50+
{
51+
return xdstrdup(path);
52+
}
53+
#endif
54+

src/lib/normalize_path.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
+----------------------------------------------------------------------+
3+
| Xdebug |
4+
+----------------------------------------------------------------------+
5+
| Copyright (c) 2002-2025 Derick Rethans |
6+
+----------------------------------------------------------------------+
7+
| This source file is subject to version 1.01 of the Xdebug license, |
8+
| that is bundled with this package in the file LICENSE, and is |
9+
| available at through the world-wide-web at |
10+
| https://xdebug.org/license.php |
11+
| If you did not receive a copy of the Xdebug license and are unable |
12+
| to obtain it through the world-wide-web, please send a note to |
13+
| [email protected] so we can mail you a copy immediately. |
14+
+----------------------------------------------------------------------+
15+
*/
16+
17+
#ifndef __HAVE_NORMALIZE_PATH_H__
18+
#define __HAVE_NORMALIZE_PATH_H__
19+
20+
#ifdef __cplusplus
21+
extern "C" {
22+
#endif
23+
24+
char *xdebug_normalize_path_char(const char *path);
25+
#ifdef PHP_WIN32
26+
void xdebug_normalize_path_xdebug_str_in_place(xdebug_str *path);
27+
#else
28+
# define xdebug_normalize_path_xdebug_str_in_place(path)
29+
#endif
30+
31+
#ifdef __cplusplus
32+
}
33+
#endif
34+
35+
#endif

tests/ctest/Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,17 @@ afl-test-parser: xdebuglib.a ${C_TESTS} ${SOURCE_FILES} ${HEADER_FILES} fuzzing-
2323
afl-test-mapper: xdebuglib.a ${C_TESTS} ${SOURCE_FILES} ${HEADER_FILES} fuzzing-shim-mapper.c
2424
afl-g++ ${CPPFLAGS} fuzzing-shim-mapper.c ${SOURCE_FILES} xdebuglib.a -I ${INCLUDE_PATH} -o afl-test-mapper ${LDFLAGS}
2525

26-
xdebuglib.a: hash.o llist.o str.o trim.o xdebug_strndup.o
27-
ar -rc xdebuglib.a hash.o llist.o str.o trim.o xdebug_strndup.o
26+
xdebuglib.a: hash.o llist.o normalize_path.o str.o trim.o xdebug_strndup.o
27+
ar -rc xdebuglib.a hash.o llist.o normalize_path.o str.o trim.o xdebug_strndup.o
28+
29+
hash.o: ../../src/lib/hash.c
30+
gcc -c ${CPPFLAGS} -o hash.o ../../src/lib/hash.c
2831

2932
llist.o: ../../src/lib/llist.c
3033
gcc -c ${CPPFLAGS} -o llist.o ../../src/lib/llist.c
3134

32-
hash.o: ../../src/lib/hash.c
33-
gcc -c ${CPPFLAGS} -o hash.o ../../src/lib/hash.c
35+
normalize_path.o: ../../src/lib/normalize_path.c
36+
gcc -c ${CPPFLAGS} -o normalize_path.o ../../src/lib/normalize_path.c
3437

3538
str.o: ../../src/lib/str.c
3639
gcc -c ${CPPFLAGS} -o str.o ../../src/lib/str.c
@@ -42,4 +45,4 @@ xdebug_strndup.o: ../../src/lib/xdebug_strndup.c
4245
gcc -c ${CPPFLAGS} -o xdebug_strndup.o ../../src/lib/xdebug_strndup.c
4346

4447
clean:
45-
rm xdebuglib.a hash.o llist.o str.o trim.o xdebug_strndup.o ctest afl-test-parser afl-test-mapper
48+
rm xdebuglib.a hash.o llist.o normalize_path.o str.o trim.o xdebug_strndup.o ctest afl-test-parser afl-test-mapper

0 commit comments

Comments
 (0)