Skip to content

Commit 8f35a3f

Browse files
committed
Remove NDEBUG constant
It was only used in our patched libmagic in a very convoluted way. The PHP_DEBUG and ZEND_DEBUG constants are always defined and should be used instead.
1 parent 5bc1e22 commit 8f35a3f

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

UPGRADING.INTERNALS

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ PHP 8.0 INTERNALS UPGRADE NOTES
1616
m. All internal functions must have arginfo
1717
n. zend_hash_sort compare function signature change
1818
o. cast_object() object handler is now required
19+
p. Removed constants
1920

2021
2. Build system changes
2122
a. Abstract
@@ -85,7 +86,7 @@ PHP 8.0 INTERNALS UPGRADE NOTES
8586
j. compare_objects() handler was removed. Extensions should use compare() object
8687
handler instead and check if both arguments are objects and have the same
8788
compare handler, using ZEND_COMPARE_OBJECTS_FALLBACK() macro.
88-
89+
8990
k. The 'I' length modifier, used to denote 32 and 64bit integer from the custom
9091
snprintf and spprintf implementations has been removed.
9192
Use the ZEND_LONG_FMT, ZEND_ULONG_FMT and ZEND_XLONG_FMT macros defined in
@@ -114,6 +115,9 @@ PHP 8.0 INTERNALS UPGRADE NOTES
114115
o. The cast_object() handler is now required, i.e. must be non-null. You can
115116
indicate that casting is not supported by always returning FAILURE.
116117

118+
p. The following constants have been removed:
119+
* NDEBUG, use !PHP_DEBUG or !ZEND_DEBUG instead
120+
117121
========================
118122
2. Build system changes
119123
========================

ext/fileinfo/libmagic.patch

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ diff -u libmagic.orig/buffer.c libmagic/buffer.c
10621062

10631063
diff -u libmagic.orig/cdf.c libmagic/cdf.c
10641064
--- libmagic.orig/cdf.c 2019-02-20 03:35:27.000000000 +0100
1065-
+++ libmagic/cdf.c 2020-04-07 22:25:10.517321000 +0200
1065+
+++ libmagic/cdf.c 2020-05-05 18:42:24.973318200 +0200
10661066
@@ -43,7 +43,17 @@
10671067
#include <err.h>
10681068
#endif
@@ -1138,7 +1138,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
11381138
static size_t
11391139
cdf_check_stream(const cdf_stream_t *sst, const cdf_header_t *h)
11401140
{
1141-
+#ifndef NDEBUG
1141+
+#if PHP_DEBUG
11421142
size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
11431143
CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
11441144
assert(ss == sst->sst_ss);
@@ -1636,7 +1636,7 @@ diff -u libmagic.orig/encoding.c libmagic/encoding.c
16361636
}
16371637
diff -u libmagic.orig/file.h libmagic/file.h
16381638
--- libmagic.orig/file.h 2019-05-07 04:27:11.000000000 +0200
1639-
+++ libmagic/file.h 2020-04-22 20:15:46.790840100 +0200
1639+
+++ libmagic/file.h 2020-05-05 18:41:04.309311200 +0200
16401640
@@ -33,18 +33,9 @@
16411641
#ifndef __file_h__
16421642
#define __file_h__
@@ -2212,7 +2212,7 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
22122212
case S_IFSOCK:
22132213
diff -u libmagic.orig/funcs.c libmagic/funcs.c
22142214
--- libmagic.orig/funcs.c 2019-05-07 04:27:11.000000000 +0200
2215-
+++ libmagic/funcs.c 2020-04-14 17:15:50.737587100 +0200
2215+
+++ libmagic/funcs.c 2020-05-05 18:41:04.309311200 +0200
22162216
@@ -31,87 +31,80 @@
22172217
#endif /* lint */
22182218

@@ -3048,7 +3048,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
30483048
public const char *
30493049
magic_error(struct magic_set *ms)
30503050
diff -u libmagic.orig/magic.h libmagic/magic.h
3051-
--- libmagic.orig/magic.h 2020-04-22 20:17:15.432186600 +0200
3051+
--- libmagic.orig/magic.h 2020-05-05 18:42:44.544159800 +0200
30523052
+++ libmagic/magic.h 2020-04-07 22:25:10.548560600 +0200
30533053
@@ -124,6 +124,7 @@
30543054

@@ -3253,7 +3253,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
32533253
if (i != -1)
32543254
diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
32553255
--- libmagic.orig/softmagic.c 2019-05-17 04:24:59.000000000 +0200
3256-
+++ libmagic/softmagic.c 2020-04-07 22:25:10.548560600 +0200
3256+
+++ libmagic/softmagic.c 2020-04-26 00:43:35.734037100 +0200
32573257
@@ -43,6 +43,10 @@
32583258
#include <time.h>
32593259
#include "der.h"

ext/fileinfo/libmagic/cdf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ cdf_zero_stream(cdf_stream_t *scn)
297297
static size_t
298298
cdf_check_stream(const cdf_stream_t *sst, const cdf_header_t *h)
299299
{
300-
#ifndef NDEBUG
300+
#if PHP_DEBUG
301301
size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
302302
CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
303303
assert(ss == sst->sst_ss);

main/php.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,6 @@ typedef int pid_t;
117117
# endif
118118
#endif
119119

120-
#if PHP_DEBUG
121-
#undef NDEBUG
122-
#else
123-
#ifndef NDEBUG
124-
#define NDEBUG
125-
#endif
126-
#endif
127120
#include <assert.h>
128121

129122
#if HAVE_UNIX_H

0 commit comments

Comments
 (0)