[php] Workaround PHP 8.2 header problem
We need to include php.h before stdio.h (and probably before most other libc headers).
This commit is contained in:
parent
55c95d475c
commit
246dd2d787
2 changed files with 8 additions and 2 deletions
|
|
@ -10,8 +10,6 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "php.h"
|
|
||||||
|
|
||||||
#if PHP_MAJOR_VERSION < 7
|
#if PHP_MAJOR_VERSION < 7
|
||||||
# error These bindings need PHP 7 or later - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5
|
# error These bindings need PHP 7 or later - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -545,6 +545,14 @@ public:
|
||||||
|
|
||||||
Swig_banner(f_begin);
|
Swig_banner(f_begin);
|
||||||
|
|
||||||
|
// We need to include php.h before string.h gets included, at least with
|
||||||
|
// PHP 8.2. Otherwise string.h is included without _GNU_SOURCE being
|
||||||
|
// included and memrchr() doesn't get declared, and then inline code in
|
||||||
|
// the PHP headers defines _GNU_SOURCE, includes string.h (which is a
|
||||||
|
// no op thanks to the include gaurds), then tries to use memrchr() and
|
||||||
|
// fails.
|
||||||
|
Append(f_runtime, "#include \"php.h\"\n\n");
|
||||||
|
|
||||||
Printf(f_runtime, "\n\n#ifndef SWIGPHP\n#define SWIGPHP\n#endif\n\n");
|
Printf(f_runtime, "\n\n#ifndef SWIGPHP\n#define SWIGPHP\n#endif\n\n");
|
||||||
|
|
||||||
if (directorsEnabled()) {
|
if (directorsEnabled()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue