summaryrefslogtreecommitdiffstats
path: root/0003-add-all-arginfo-and-fix-build-with-PHP-8.patch
blob: 1b2a1f5c26590195d5c9c09fadb883686a6128c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
From bfef69aca744295719dc8f859005ff83e17ac48c Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 28 Aug 2020 15:21:36 +0200
Subject: [PATCH 3/6] add all arginfo and fix build with PHP 8

---
 arginfo.h                | 319 +++++++++++++++++++++++++++++++++++++++
 geos.c                   | 190 ++++++++++++-----------
 php_geos.h               |   9 ++
 tests/002_WKTWriter.phpt |   2 +
 tests/003_WKTReader.phpt |   2 +
 tests/004_WKBWriter.phpt |   6 +-
 6 files changed, 435 insertions(+), 93 deletions(-)
 create mode 100644 arginfo.h

diff --git a/arginfo.h b/arginfo.h
new file mode 100644
index 0000000..3bee988
--- /dev/null
+++ b/arginfo.h
@@ -0,0 +1,319 @@
+/* commonly used ones */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_geom, 0, 0, 1)
+    ZEND_ARG_INFO(0, geom)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_num, 0, 0, 1)
+    ZEND_ARG_INFO(0, num)
+ZEND_END_ARG_INFO()
+
+/* function arginfo */
+
+#define arginfo_GEOSVersion              arginfo_void
+
+#define arginfo_GEOSPolygonize           arginfo_geom
+#define arginfo_GEOSLineMerge            arginfo_geom
+
+#ifdef HAVE_GEOS_SHARED_PATHS
+ZEND_BEGIN_ARG_INFO_EX(arginfo_GEOSSharedPaths, 0, 0, 2)
+    ZEND_ARG_INFO(0, geom1)
+    ZEND_ARG_INFO(0, geom2)
+ZEND_END_ARG_INFO()
+#endif
+
+#ifdef HAVE_GEOS_RELATE_PATTERN_MATCH
+ZEND_BEGIN_ARG_INFO_EX(arginfo_GEOSRelateMatch, 0, 0, 2)
+    ZEND_ARG_INFO(0, maxtric)
+    ZEND_ARG_INFO(0, pattern)
+ZEND_END_ARG_INFO()
+#endif
+
+/* GEOSGeometry methods arginfo */
+
+#define arginfo_Geometry_construct       arginfo_void
+
+#define arginfo_Geometry_toString        arginfo_void
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_Geometry_project, 0, 0, 1)
+    ZEND_ARG_INFO(0, geom)
+    ZEND_ARG_INFO(0, normalized)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_Geometry_interpolate, 0, 0, 1)
+    ZEND_ARG_INFO(0, dist)
+    ZEND_ARG_INFO(0, normalized)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_Geometry_buffer, 0, 0, 1)
+    ZEND_ARG_INFO(0, dist)
+    ZEND_ARG_INFO(0, style)
+ZEND_END_ARG_INFO()
+
+#ifdef HAVE_GEOS_OFFSET_CURVE
+#define arginfo_Geometry_offsetCurve     arginfo_Geometry_buffer
+#endif
+
+#define arginfo_Geometry_envelope        arginfo_void
+
+#define arginfo_Geometry_intersection    arginfo_geom
+
+#define arginfo_Geometry_convexHull      arginfo_void
+
+#define arginfo_Geometry_difference      arginfo_geom
+
+#define arginfo_Geometry_symDifference   arginfo_geom
+
+#define arginfo_Geometry_boundary        arginfo_void
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_Geometry_union, 0, 0, 0)
+    ZEND_ARG_INFO(0, geom)
+ZEND_END_ARG_INFO()
+
+#define arginfo_Geometry_pointOnSurface  arginfo_void
+
+#define arginfo_Geometry_centroid        arginfo_void
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_Geometry_relate, 0, 0, 1)
+    ZEND_ARG_INFO(0, geom)
+    ZEND_ARG_INFO(0, pattern)
+ZEND_END_ARG_INFO()
+
+#ifdef HAVE_GEOS_RELATE_BOUNDARY_NODE_RULE
+ZEND_BEGIN_ARG_INFO_EX(arginfo_Geometry_relateBoundaryNodeRule, 0, 0, 2)
+    ZEND_ARG_INFO(0, geom)
+    ZEND_ARG_INFO(0, rule)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_Geometry_simplify, 0, 0, 1)
+    ZEND_ARG_INFO(0, tolerance)
+    ZEND_ARG_INFO(0, preserveTopology)
+ZEND_END_ARG_INFO()
+
+#define arginfo_Geometry_normalize       arginfo_void
+
+#ifdef HAVE_GEOS_GEOM_SET_PRECISION
+ZEND_BEGIN_ARG_INFO_EX(arginfo_Geometry_setPrecision, 0, 0, 1)
+    ZEND_ARG_INFO(0, gridsize)
+    ZEND_ARG_INFO(0, flags)
+ZEND_END_ARG_INFO()
+#endif
+
+#ifdef HAVE_GEOS_GEOM_GET_PRECISION
+#define arginfo_Geometry_getPrecision    arginfo_void
+#endif
+
+#ifdef HAVE_GEOS_GEOM_EXTRACT_UNIQUE_POINTS
+#define arginfo_Geometry_extractUniquePoints arginfo_void
+#endif
+
+#define arginfo_Geometry_disjoint        arginfo_geom
+
+#define arginfo_Geometry_touches         arginfo_geom
+
+#define arginfo_Geometry_intersects      arginfo_geom
+
+#define arginfo_Geometry_crosses         arginfo_geom
+
+#define arginfo_Geometry_within          arginfo_geom
+
+#define arginfo_Geometry_contains        arginfo_geom
+
+#define arginfo_Geometry_overlaps        arginfo_geom
+
+#ifdef HAVE_GEOS_COVERS
+#define arginfo_Geometry_covers          arginfo_geom
+#endif
+
+#ifdef HAVE_GEOS_COVERED_BY
+#define arginfo_Geometry_coveredBy       arginfo_geom
+#endif
+
+#define arginfo_Geometry_equals          arginfo_geom
+
+#define arginfo_Geometry_equalsExact     arginfo_geom
+
+#define arginfo_Geometry_isEmpty         arginfo_void
+
+#ifdef HAVE_GEOS_IS_VALID_DETAIL
+ZEND_BEGIN_ARG_INFO_EX(arginfo_Geometry_checkValidity, 0, 0, 0)
+    ZEND_ARG_INFO(0, flags)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_Geometry_isSimple        arginfo_void
+
+#define arginfo_Geometry_isRing          arginfo_void
+
+#define arginfo_Geometry_hasZ            arginfo_void
+
+
+#ifdef HAVE_GEOS_IS_CLOSED
+#define arginfo_Geometry_isClosed        arginfo_void
+#endif
+
+#define arginfo_Geometry_typeName        arginfo_void
+
+#define arginfo_Geometry_typeId          arginfo_void
+
+#define arginfo_Geometry_getSRID         arginfo_void
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_Geometry_setSRID, 0, 0, 0)
+    ZEND_ARG_INFO(0, srid)
+ZEND_END_ARG_INFO()
+
+#define arginfo_Geometry_numGeometries   arginfo_void
+
+#define arginfo_Geometry_geometryN       arginfo_num
+
+#define arginfo_Geometry_numInteriorRings arginfo_void
+
+#ifdef HAVE_GEOS_GEOM_GET_NUM_POINTS
+#define arginfo_Geometry_numPoints       arginfo_void
+#endif
+
+#ifdef HAVE_GEOS_GEOM_GET_X
+#define arginfo_Geometry_getX            arginfo_void
+#endif
+
+#ifdef HAVE_GEOS_GEOM_GET_Y
+#define arginfo_Geometry_getY            arginfo_void
+#endif
+
+#define arginfo_Geometry_interiorRingN   arginfo_num
+
+#define arginfo_Geometry_exteriorRing    arginfo_void
+
+#define arginfo_Geometry_numCoordinates  arginfo_void
+
+#define arginfo_Geometry_dimension       arginfo_void
+
+#ifdef HAVE_GEOS_GEOM_GET_COORDINATE_DIMENSION
+#define arginfo_Geometry_coordinateDimension arginfo_void
+#endif
+
+#ifdef HAVE_GEOS_GEOM_GET_POINT_N
+#define arginfo_Geometry_pointN          arginfo_num
+#endif
+
+#ifdef HAVE_GEOS_GEOM_GET_START_POINT
+#define arginfo_Geometry_startPoint      arginfo_void
+#endif
+
+#ifdef HAVE_GEOS_GEOM_GET_END_POINT
+#define arginfo_Geometry_endPoint        arginfo_void
+#endif
+
+#define arginfo_Geometry_area            arginfo_void
+
+#define arginfo_Geometry_length          arginfo_void
+
+#define arginfo_Geometry_distance        arginfo_geom
+
+#define arginfo_Geometry_hausdorffDistance arginfo_geom
+
+#ifdef HAVE_GEOS_SNAP
+ZEND_BEGIN_ARG_INFO_EX(arginfo_Geometry_snapTo, 0, 0, 2)
+    ZEND_ARG_INFO(0, geom)
+    ZEND_ARG_INFO(0, tolerance)
+ZEND_END_ARG_INFO()
+#endif
+
+#ifdef HAVE_GEOS_NODE
+#define arginfo_Geometry_node            arginfo_void
+#endif
+
+#ifdef HAVE_GEOS_DELAUNAY_TRIANGULATION
+ZEND_BEGIN_ARG_INFO_EX(arginfo_Geometry_delaunayTriangulation, 0, 0, 0)
+    ZEND_ARG_INFO(0, tolerance)
+    ZEND_ARG_INFO(0, edgeonly)
+ZEND_END_ARG_INFO()
+#endif
+
+#ifdef HAVE_GEOS_VORONOI_DIAGRAM
+ZEND_BEGIN_ARG_INFO_EX(arginfo_Geometry_voronoiDiagram, 0, 0, 0)
+    ZEND_ARG_INFO(0, tolerance)
+    ZEND_ARG_INFO(0, edgeonly)
+    ZEND_ARG_INFO(0, extent)
+ZEND_END_ARG_INFO()
+#endif
+
+#ifdef HAVE_GEOS_CLIP_BY_RECT
+ZEND_BEGIN_ARG_INFO_EX(arginfo_Geometry_clipByRect, 0, 0, 4)
+    ZEND_ARG_INFO(0, xmin)
+    ZEND_ARG_INFO(0, ymin)
+    ZEND_ARG_INFO(0, xmax)
+    ZEND_ARG_INFO(0, ymax)
+ZEND_END_ARG_INFO()
+#endif
+
+/* GEOSWKBReader methods arginfo */
+
+#define arginfo_WKBReader_construct      arginfo_void
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_WKBReader_read, 0, 0, 1)
+    ZEND_ARG_INFO(0, wkb)
+ZEND_END_ARG_INFO()
+
+#define arginfo_WKBReader_readHEX        arginfo_WKBReader_read
+
+/* GEOSWKTReader methods arginfo */
+
+#define arginfo_WKTReader_construct      arginfo_void
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_WKTReader_read, 0, 0, 1)
+    ZEND_ARG_INFO(0, wkt)
+ZEND_END_ARG_INFO()
+
+/* GEOSWKTWriter methods arginfo */
+
+#define arginfo_WKTWriter_construct      arginfo_void
+
+#define arginfo_WKTWriter_write          arginfo_geom
+
+#ifdef HAVE_GEOS_WKT_WRITER_SET_TRIM
+#define arginfo_WKTWriter_setTrim        arginfo_num
+#endif
+
+#ifdef HAVE_GEOS_WKT_WRITER_SET_ROUNDING_PRECISION
+#define arginfo_WKTWriter_setRoundingPrecision arginfo_num
+#endif
+
+#ifdef HAVE_GEOS_WKT_WRITER_SET_OUTPUT_DIMENSION
+#define arginfo_WKTWriter_setOutputDimension   arginfo_num
+#endif
+
+#ifdef HAVE_GEOS_WKT_WRITER_GET_OUTPUT_DIMENSION
+#define arginfo_WKTWriter_getOutputDimension arginfo_void
+#endif
+
+#ifdef HAVE_GEOS_WKT_WRITER_SET_OLD_3D
+ZEND_BEGIN_ARG_INFO_EX(arginfo_WKTWriter_setOld3D, 0, 0, 1)
+    ZEND_ARG_INFO(0, bval)
+ZEND_END_ARG_INFO()
+#endif
+
+/* GEOSWKTWriter methods arginfo */
+
+#define arginfo_WKBWriter_construct          arginfo_void
+
+#define arginfo_WKBWriter_getOutputDimension arginfo_void
+
+#define arginfo_WKBWriter_setOutputDimension arginfo_num
+
+#define arginfo_WKBWriter_getByteOrder       arginfo_void
+
+#define arginfo_WKBWriter_setByteOrder       arginfo_num
+
+#define arginfo_WKBWriter_setIncludeSRID     arginfo_num
+
+#define arginfo_WKBWriter_getIncludeSRID     arginfo_void
+
+#define arginfo_WKBWriter_write              arginfo_geom
+
+#define arginfo_WKBWriter_writeHEX           arginfo_geom
+
diff --git a/geos.c b/geos.c
index fc679e8..ffa27b8 100755
--- a/geos.c
+++ b/geos.c
@@ -32,6 +32,7 @@
 
 /* Own stuff */
 #include "php_geos.h"
+#include "arginfo.h"
 
 static ZEND_DECLARE_MODULE_GLOBALS(geos);
 static PHP_GINIT_FUNCTION(geos);
@@ -84,18 +85,23 @@ PHP_FUNCTION(GEOSRelateMatch);
 
 
 static zend_function_entry geos_functions[] = {
-    PHP_FE(GEOSVersion, NULL)
-    PHP_FE(GEOSPolygonize, NULL)
-    PHP_FE(GEOSLineMerge, NULL)
+    PHP_FE(GEOSVersion, arginfo_GEOSVersion)
+    PHP_FE(GEOSPolygonize, arginfo_GEOSPolygonize)
+    PHP_FE(GEOSLineMerge, arginfo_GEOSLineMerge)
 
 #   ifdef HAVE_GEOS_SHARED_PATHS
-    PHP_FE(GEOSSharedPaths, NULL)
+    PHP_FE(GEOSSharedPaths, arginfo_GEOSSharedPaths)
 #   endif
 
 #   ifdef HAVE_GEOS_RELATE_PATTERN_MATCH
-    PHP_FE(GEOSRelateMatch, NULL)
+    PHP_FE(GEOSRelateMatch, arginfo_GEOSRelateMatch)
 #   endif
+
+#ifdef PHP_FE_END
+    PHP_FE_END
+#else
     {NULL, NULL, NULL}
+#endif
 };
 
 zend_module_entry geos_module_entry = {
@@ -428,142 +434,142 @@ PHP_METHOD(Geometry, clipByRect);
 #endif
 
 static zend_function_entry Geometry_methods[] = {
-    PHP_ME(Geometry, __construct, NULL, 0)
-    PHP_ME(Geometry, __toString, NULL, 0)
-    PHP_ME(Geometry, project, NULL, 0)
-    PHP_ME(Geometry, interpolate, NULL, 0)
-    PHP_ME(Geometry, buffer, NULL, 0)
+    PHP_ME(Geometry, __construct, arginfo_Geometry_construct, 0)
+    PHP_ME(Geometry, __toString, arginfo_Geometry_toString, 0)
+    PHP_ME(Geometry, project, arginfo_Geometry_project, 0)
+    PHP_ME(Geometry, interpolate, arginfo_Geometry_interpolate, 0)
+    PHP_ME(Geometry, buffer, arginfo_Geometry_buffer, 0)
 
 #   ifdef HAVE_GEOS_OFFSET_CURVE
-    PHP_ME(Geometry, offsetCurve, NULL, 0)
+    PHP_ME(Geometry, offsetCurve, arginfo_Geometry_offsetCurve, 0)
 #   endif
 
-    PHP_ME(Geometry, envelope, NULL, 0)
-    PHP_ME(Geometry, intersection, NULL, 0)
-    PHP_ME(Geometry, convexHull, NULL, 0)
-    PHP_ME(Geometry, difference, NULL, 0)
-    PHP_ME(Geometry, symDifference, NULL, 0)
-    PHP_ME(Geometry, boundary, NULL, 0)
-    PHP_ME(Geometry, union, NULL, 0)
-    PHP_ME(Geometry, pointOnSurface, NULL, 0)
-    PHP_ME(Geometry, centroid, NULL, 0)
-    PHP_ME(Geometry, relate, NULL, 0)
+    PHP_ME(Geometry, envelope, arginfo_Geometry_envelope, 0)
+    PHP_ME(Geometry, intersection, arginfo_Geometry_intersection, 0)
+    PHP_ME(Geometry, convexHull, arginfo_Geometry_convexHull, 0)
+    PHP_ME(Geometry, difference, arginfo_Geometry_difference, 0)
+    PHP_ME(Geometry, symDifference, arginfo_Geometry_symDifference, 0)
+    PHP_ME(Geometry, boundary, arginfo_Geometry_boundary, 0)
+    PHP_ME(Geometry, union, arginfo_Geometry_union, 0)
+    PHP_ME(Geometry, pointOnSurface, arginfo_Geometry_pointOnSurface, 0)
+    PHP_ME(Geometry, centroid, arginfo_Geometry_centroid, 0)
+    PHP_ME(Geometry, relate, arginfo_Geometry_relate, 0)
 
 #   ifdef HAVE_GEOS_RELATE_BOUNDARY_NODE_RULE
-    PHP_ME(Geometry, relateBoundaryNodeRule, NULL, 0)
+    PHP_ME(Geometry, relateBoundaryNodeRule, arginfo_Geometry_relateBoundaryNodeRule, 0)
 #   endif
 
-    PHP_ME(Geometry, simplify, NULL, 0)
-    PHP_ME(Geometry, normalize, NULL, 0)
+    PHP_ME(Geometry, simplify, arginfo_Geometry_simplify, 0)
+    PHP_ME(Geometry, normalize, arginfo_Geometry_normalize, 0)
 
 #   ifdef HAVE_GEOS_GEOM_SET_PRECISION
-    PHP_ME(Geometry, setPrecision, NULL, 0)
+    PHP_ME(Geometry, setPrecision, arginfo_Geometry_setPrecision, 0)
 #   endif
 
 #   if HAVE_GEOS_GEOM_GET_PRECISION
-    PHP_ME(Geometry, getPrecision, NULL, 0)
+    PHP_ME(Geometry, getPrecision, arginfo_Geometry_getPrecision, 0)
 #   endif
 
 #   ifdef HAVE_GEOS_GEOM_EXTRACT_UNIQUE_POINTS
-    PHP_ME(Geometry, extractUniquePoints, NULL, 0)
+    PHP_ME(Geometry, extractUniquePoints, arginfo_Geometry_extractUniquePoints, 0)
 #   endif
 
-    PHP_ME(Geometry, disjoint, NULL, 0)
-    PHP_ME(Geometry, touches, NULL, 0)
-    PHP_ME(Geometry, intersects, NULL, 0)
-    PHP_ME(Geometry, crosses, NULL, 0)
-    PHP_ME(Geometry, within, NULL, 0)
-    PHP_ME(Geometry, contains, NULL, 0)
-    PHP_ME(Geometry, overlaps, NULL, 0)
+    PHP_ME(Geometry, disjoint, arginfo_Geometry_disjoint, 0)
+    PHP_ME(Geometry, touches, arginfo_Geometry_touches, 0)
+    PHP_ME(Geometry, intersects, arginfo_Geometry_intersects, 0)
+    PHP_ME(Geometry, crosses, arginfo_Geometry_crosses, 0)
+    PHP_ME(Geometry, within, arginfo_Geometry_within, 0)
+    PHP_ME(Geometry, contains, arginfo_Geometry_contains, 0)
+    PHP_ME(Geometry, overlaps, arginfo_Geometry_overlaps, 0)
 
 #   ifdef HAVE_GEOS_COVERS
-    PHP_ME(Geometry, covers, NULL, 0)
+    PHP_ME(Geometry, covers, arginfo_Geometry_covers, 0)
 #   endif
 
 #   ifdef HAVE_GEOS_COVERED_BY
-    PHP_ME(Geometry, coveredBy, NULL, 0)
+    PHP_ME(Geometry, coveredBy, arginfo_Geometry_coveredBy, 0)
 #   endif
 
-    PHP_ME(Geometry, equals, NULL, 0)
-    PHP_ME(Geometry, equalsExact, NULL, 0)
-    PHP_ME(Geometry, isEmpty, NULL, 0)
+    PHP_ME(Geometry, equals, arginfo_Geometry_equals, 0)
+    PHP_ME(Geometry, equalsExact, arginfo_Geometry_equalsExact, 0)
+    PHP_ME(Geometry, isEmpty, arginfo_Geometry_isEmpty, 0)
 
 #   ifdef HAVE_GEOS_IS_VALID_DETAIL
-    PHP_ME(Geometry, checkValidity, NULL, 0)
+    PHP_ME(Geometry, checkValidity, arginfo_Geometry_checkValidity, 0)
 #   endif
 
-    PHP_ME(Geometry, isSimple, NULL, 0)
-    PHP_ME(Geometry, isRing, NULL, 0)
-    PHP_ME(Geometry, hasZ, NULL, 0)
+    PHP_ME(Geometry, isSimple, arginfo_Geometry_isSimple, 0)
+    PHP_ME(Geometry, isRing, arginfo_Geometry_isRing, 0)
+    PHP_ME(Geometry, hasZ, arginfo_Geometry_hasZ, 0)
 
 #   ifdef HAVE_GEOS_IS_CLOSED
-    PHP_ME(Geometry, isClosed, NULL, 0)
+    PHP_ME(Geometry, isClosed, arginfo_Geometry_isClosed, 0)
 #   endif
 
-    PHP_ME(Geometry, typeName, NULL, 0)
-    PHP_ME(Geometry, typeId, NULL, 0)
-    PHP_ME(Geometry, getSRID, NULL, 0)
-    PHP_ME(Geometry, setSRID, NULL, 0)
-    PHP_ME(Geometry, numGeometries, NULL, 0)
-    PHP_ME(Geometry, geometryN, NULL, 0)
-    PHP_ME(Geometry, numInteriorRings, NULL, 0)
+    PHP_ME(Geometry, typeName, arginfo_Geometry_typeName, 0)
+    PHP_ME(Geometry, typeId, arginfo_Geometry_typeId, 0)
+    PHP_ME(Geometry, getSRID, arginfo_Geometry_getSRID, 0)
+    PHP_ME(Geometry, setSRID, arginfo_Geometry_setSRID, 0)
+    PHP_ME(Geometry, numGeometries, arginfo_Geometry_numGeometries, 0)
+    PHP_ME(Geometry, geometryN, arginfo_Geometry_geometryN, 0)
+    PHP_ME(Geometry, numInteriorRings, arginfo_Geometry_numInteriorRings, 0)
 
 #   ifdef HAVE_GEOS_GEOM_GET_NUM_POINTS
-    PHP_ME(Geometry, numPoints, NULL, 0)
+    PHP_ME(Geometry, numPoints, arginfo_Geometry_numPoints, 0)
 #   endif
 
 #   ifdef HAVE_GEOS_GEOM_GET_X
-    PHP_ME(Geometry, getX, NULL, 0)
+    PHP_ME(Geometry, getX, arginfo_Geometry_getX, 0)
 #   endif
 
 #   ifdef HAVE_GEOS_GEOM_GET_Y
-    PHP_ME(Geometry, getY, NULL, 0)
+    PHP_ME(Geometry, getY, arginfo_Geometry_getY, 0)
 #   endif
 
-    PHP_ME(Geometry, interiorRingN, NULL, 0)
-    PHP_ME(Geometry, exteriorRing, NULL, 0)
-    PHP_ME(Geometry, numCoordinates, NULL, 0)
-    PHP_ME(Geometry, dimension, NULL, 0)
+    PHP_ME(Geometry, interiorRingN, arginfo_Geometry_interiorRingN, 0)
+    PHP_ME(Geometry, exteriorRing, arginfo_Geometry_exteriorRing, 0)
+    PHP_ME(Geometry, numCoordinates, arginfo_Geometry_numCoordinates, 0)
+    PHP_ME(Geometry, dimension, arginfo_Geometry_dimension, 0)
 
 #   ifdef HAVE_GEOS_GEOM_GET_COORDINATE_DIMENSION
-    PHP_ME(Geometry, coordinateDimension, NULL, 0)
+    PHP_ME(Geometry, coordinateDimension, arginfo_Geometry_coordinateDimension, 0)
 #   endif
 
 #   ifdef HAVE_GEOS_GEOM_GET_POINT_N
-    PHP_ME(Geometry, pointN, NULL, 0)
+    PHP_ME(Geometry, pointN, arginfo_Geometry_pointN, 0)
 #   endif
 
 #   ifdef HAVE_GEOS_GEOM_GET_START_POINT
-    PHP_ME(Geometry, startPoint, NULL, 0)
+    PHP_ME(Geometry, startPoint, arginfo_Geometry_startPoint, 0)
 #   endif
 
 #   ifdef HAVE_GEOS_GEOM_GET_END_POINT
-    PHP_ME(Geometry, endPoint, NULL, 0)
+    PHP_ME(Geometry, endPoint, arginfo_Geometry_endPoint, 0)
 #   endif
 
-    PHP_ME(Geometry, area, NULL, 0)
-    PHP_ME(Geometry, length, NULL, 0)
-    PHP_ME(Geometry, distance, NULL, 0)
-    PHP_ME(Geometry, hausdorffDistance, NULL, 0)
+    PHP_ME(Geometry, area, arginfo_Geometry_area, 0)
+    PHP_ME(Geometry, length, arginfo_Geometry_length, 0)
+    PHP_ME(Geometry, distance, arginfo_Geometry_distance, 0)
+    PHP_ME(Geometry, hausdorffDistance, arginfo_Geometry_hausdorffDistance, 0)
 
 #   if HAVE_GEOS_SNAP
-    PHP_ME(Geometry, snapTo, NULL, 0)
+    PHP_ME(Geometry, snapTo, arginfo_Geometry_snapTo, 0)
 #   endif
 
 #   ifdef HAVE_GEOS_NODE
-    PHP_ME(Geometry, node, NULL, 0)
+    PHP_ME(Geometry, node, arginfo_Geometry_node, 0)
 #   endif
 
 #   ifdef HAVE_GEOS_DELAUNAY_TRIANGULATION
-    PHP_ME(Geometry, delaunayTriangulation, NULL, 0)
+    PHP_ME(Geometry, delaunayTriangulation, arginfo_Geometry_delaunayTriangulation, 0)
 #   endif
 
 #   ifdef HAVE_GEOS_VORONOI_DIAGRAM
-    PHP_ME(Geometry, voronoiDiagram, NULL, 0)
+    PHP_ME(Geometry, voronoiDiagram, arginfo_Geometry_voronoiDiagram, 0)
 #   endif
 
 #   ifdef HAVE_GEOS_CLIP_BY_RECT
-    PHP_ME(Geometry, clipByRect, NULL, 0)
+    PHP_ME(Geometry, clipByRect, arginfo_Geometry_clipByRect, 0)
 #   endif
 
     {NULL, NULL, NULL}
@@ -2347,8 +2353,8 @@ PHP_METHOD(WKTReader, __construct);
 PHP_METHOD(WKTReader, read);
 
 static zend_function_entry WKTReader_methods[] = {
-    PHP_ME(WKTReader, __construct, NULL, 0)
-    PHP_ME(WKTReader, read, NULL, 0)
+    PHP_ME(WKTReader, __construct, arginfo_WKTReader_construct, 0)
+    PHP_ME(WKTReader, read, arginfo_WKTReader_read, 0)
     {NULL, NULL, NULL}
 };
 
@@ -2457,27 +2463,27 @@ PHP_METHOD(WKTWriter, setOld3D);
 #endif
 
 static zend_function_entry WKTWriter_methods[] = {
-    PHP_ME(WKTWriter, __construct, NULL, 0)
-    PHP_ME(WKTWriter, write, NULL, 0)
+    PHP_ME(WKTWriter, __construct, arginfo_WKTWriter_construct, 0)
+    PHP_ME(WKTWriter, write, arginfo_WKTWriter_write, 0)
 
 #   ifdef HAVE_GEOS_WKT_WRITER_SET_TRIM
-    PHP_ME(WKTWriter, setTrim, NULL, 0)
+    PHP_ME(WKTWriter, setTrim, arginfo_WKTWriter_setTrim, 0)
 #   endif
 
 #   ifdef HAVE_GEOS_WKT_WRITER_SET_ROUNDING_PRECISION
-    PHP_ME(WKTWriter, setRoundingPrecision, NULL, 0)
+    PHP_ME(WKTWriter, setRoundingPrecision, arginfo_WKTWriter_setRoundingPrecision, 0)
 #   endif
 
 #   ifdef HAVE_GEOS_WKT_WRITER_SET_OUTPUT_DIMENSION
-    PHP_ME(WKTWriter, setOutputDimension, NULL, 0)
+    PHP_ME(WKTWriter, setOutputDimension, arginfo_WKTWriter_setOutputDimension, 0)
 #   endif
 
 #   ifdef HAVE_GEOS_WKT_WRITER_GET_OUTPUT_DIMENSION
-    PHP_ME(WKTWriter, getOutputDimension, NULL, 0)
+    PHP_ME(WKTWriter, getOutputDimension, arginfo_WKTWriter_getOutputDimension, 0)
 #   endif
 
 #   ifdef HAVE_GEOS_WKT_WRITER_SET_OLD_3D
-    PHP_ME(WKTWriter, setOld3D, NULL, 0)
+    PHP_ME(WKTWriter, setOld3D, arginfo_WKTWriter_setOld3D, 0)
 #   endif
 
     {NULL, NULL, NULL}
@@ -2665,15 +2671,15 @@ PHP_METHOD(WKBWriter, write);
 PHP_METHOD(WKBWriter, writeHEX);
 
 static zend_function_entry WKBWriter_methods[] = {
-    PHP_ME(WKBWriter, __construct, NULL, 0)
-    PHP_ME(WKBWriter, getOutputDimension, NULL, 0)
-    PHP_ME(WKBWriter, setOutputDimension, NULL, 0)
-    PHP_ME(WKBWriter, getByteOrder, NULL, 0)
-    PHP_ME(WKBWriter, setByteOrder, NULL, 0)
-    PHP_ME(WKBWriter, getIncludeSRID, NULL, 0)
-    PHP_ME(WKBWriter, setIncludeSRID, NULL, 0)
-    PHP_ME(WKBWriter, write, NULL, 0)
-    PHP_ME(WKBWriter, writeHEX, NULL, 0)
+    PHP_ME(WKBWriter, __construct, arginfo_WKBWriter_construct, 0)
+    PHP_ME(WKBWriter, getOutputDimension, arginfo_WKBWriter_getOutputDimension, 0)
+    PHP_ME(WKBWriter, setOutputDimension, arginfo_WKBWriter_setOutputDimension, 0)
+    PHP_ME(WKBWriter, getByteOrder, arginfo_WKBWriter_getByteOrder, 0)
+    PHP_ME(WKBWriter, setByteOrder, arginfo_WKBWriter_setByteOrder, 0)
+    PHP_ME(WKBWriter, getIncludeSRID, arginfo_WKBWriter_getIncludeSRID, 0)
+    PHP_ME(WKBWriter, setIncludeSRID, arginfo_WKBWriter_setIncludeSRID, 0)
+    PHP_ME(WKBWriter, write, arginfo_WKBWriter_write, 0)
+    PHP_ME(WKBWriter, writeHEX, arginfo_WKBWriter_writeHEX, 0)
     {NULL, NULL, NULL}
 };
 
@@ -2904,9 +2910,9 @@ PHP_METHOD(WKBReader, read);
 PHP_METHOD(WKBReader, readHEX);
 
 static zend_function_entry WKBReader_methods[] = {
-    PHP_ME(WKBReader, __construct, NULL, 0)
-    PHP_ME(WKBReader, read, NULL, 0)
-    PHP_ME(WKBReader, readHEX, NULL, 0)
+    PHP_ME(WKBReader, __construct, arginfo_WKBReader_construct, 0)
+    PHP_ME(WKBReader, read, arginfo_WKBReader_read, 0)
+    PHP_ME(WKBReader, readHEX, arginfo_WKBReader_readHEX, 0)
     {NULL, NULL, NULL}
 };
 
diff --git a/php_geos.h b/php_geos.h
index 5350541..0b8fdcb 100644
--- a/php_geos.h
+++ b/php_geos.h
@@ -48,6 +48,15 @@ extern zend_module_entry geos_module_entry;
 #define GEOS_G(v) (geos_globals.v)
 #endif
 
+/* for PHP 8 */
+#ifndef TSRMLS_D
+#define TSRMLS_D void
+#define TSRMLS_DC
+#define TSRMLS_C
+#define TSRMLS_CC
+#define TSRMLS_FETCH()
+#endif
+
 ZEND_BEGIN_MODULE_GLOBALS(geos)
 GEOSContextHandle_t handle;
 ZEND_END_MODULE_GLOBALS(geos)
diff --git a/tests/002_WKTWriter.phpt b/tests/002_WKTWriter.phpt
index 6bb7253..3682a3a 100644
--- a/tests/002_WKTWriter.phpt
+++ b/tests/002_WKTWriter.phpt
@@ -25,6 +25,8 @@ class WKTWriterTest extends GEOSTest
             $this->assertTrue(FALSE); # this is just to fail if we get here
         } catch (Exception $e) {
             $this->assertContains('expects parameter 1', $e->getMessage());
+        } catch (Error $e) {
+            $this->assertContains('Argument #1', $e->getMessage());
         }
 
         $g = $reader->read('POINT(6 7)');
diff --git a/tests/003_WKTReader.phpt b/tests/003_WKTReader.phpt
index 7bcbf54..fbd4fb1 100644
--- a/tests/003_WKTReader.phpt
+++ b/tests/003_WKTReader.phpt
@@ -99,6 +99,8 @@ class WKTReaderTest extends GEOSTest
         } catch (Exception $e) {
             $this->assertContains('expects exactly 1 parameter',
                                   $e->getMessage());
+        } catch (Error $e) {
+            $this->assertContains('expects exactly 1 parameter', $e->getMessage());
         }
     }
 }
diff --git a/tests/004_WKBWriter.phpt b/tests/004_WKBWriter.phpt
index 3a72e2d..3c13644 100644
--- a/tests/004_WKBWriter.phpt
+++ b/tests/004_WKBWriter.phpt
@@ -140,6 +140,8 @@ class WKBWriterTest extends GEOSTest
             $this->assertTrue(false);
         } catch (ErrorException $e) {
             $this->assertContains('expects parameter 1 to be object, int', $e->getMessage());
+        } catch (Error $e) {
+            $this->assertContains('Argument #1', $e->getMessage());
         }
     }
 
@@ -152,7 +154,9 @@ class WKBWriterTest extends GEOSTest
             $this->assertTrue(false);
         } catch (ErrorException $e) {
             $this->assertContains('expects parameter 1 to be object, int', $e->getMessage());
-        }
+        } catch (Error $e) {
+            $this->assertContains('Argument #1', $e->getMessage());
+	    }
     }
 }
 
-- 
2.37.2