- updated to 3.5.0 (note: new libgeos soname)
[packages/geos.git] / geos-php7.patch
CommitLineData
ccc0fb6d
JB
1--- geos-3.5.0/php/geos.c.orig 2015-08-14 20:23:15.000000000 +0200
2+++ geos-3.5.0/php/geos.c 2016-03-18 22:08:27.255515276 +0100
3@@ -48,6 +48,21 @@
4 #define zend_function_entry function_entry
5 #endif
6
7+#if PHP_MAJOR_VERSION >= 7
8+#define zend_uint zend_ulong
9+#define PHP_RETURN_STRING(x, n) RETURN_STRING(x)
10+#define PHP_RETURN_STRINGL(x, l, n) RETURN_STRINGL(x, l)
11+#define php_zend_hash_get_current_key(s, k, i, n) zend_hash_get_current_key(s, k, i)
12+#define php_add_assoc_string(rv, res, resv, n) add_assoc_string(rv, res, resv)
13+#define PHP_KEY_VAL(key) ZSTR_VAL(key)
14+#else
15+#define PHP_RETURN_STRING(x, n) RETURN_STRING(x, n)
16+#define PHP_RETURN_STRINGL(x, l, n) RETURN_STRINGL(x, l, n)
17+#define php_zend_hash_get_current_key(s, k, i, n) zend_hash_get_current_key(s, k, i, n)
18+#define php_add_assoc_string(rv, res, resv, n) add_assoc_string(rv, res, resv, n)
19+#define PHP_KEY_VAL(key) (key)
20+#endif
21+
22 static zend_function_entry geos_functions[] = {
23 PHP_FE(GEOSVersion, NULL)
24 PHP_FE(GEOSPolygonize, NULL)
25@@ -104,21 +119,34 @@
26 }
27
28 typedef struct Proxy_t {
29+#if PHP_MAJOR_VERSION >= 7
30+ void* relay;
31+ zend_object std;
32+#else
33 zend_object std;
34 void* relay;
35+#endif
36 } Proxy;
37
38 static void
39 setRelay(zval* val, void* obj) {
40 TSRMLS_FETCH();
41+#if PHP_MAJOR_VERSION >= 7
42+ Proxy* proxy = (Proxy*)((char*)(Z_OBJ_P(val)) - XtOffsetOf(Proxy, std));
43+#else
44 Proxy* proxy = (Proxy*)zend_object_store_get_object(val TSRMLS_CC);
45+#endif
46 proxy->relay = obj;
47 }
48
49 static inline void *
50 getRelay(zval* val, zend_class_entry* ce) {
51 TSRMLS_FETCH();
52- Proxy *proxy = (Proxy*)zend_object_store_get_object(val TSRMLS_CC);
53+#if PHP_MAJOR_VERSION >= 7
54+ Proxy* proxy = (Proxy*)((char*)(Z_OBJ_P(val)) - XtOffsetOf(Proxy, std));
55+#else
56+ Proxy* proxy = (Proxy*)zend_object_store_get_object(val TSRMLS_CC);
57+#endif
58 if ( proxy->std.ce != ce ) {
59 php_error_docref(NULL TSRMLS_CC, E_ERROR,
60 "Relay object is not an %s", ce->name);
61@@ -156,16 +184,29 @@
62 return ret;
63 }
64
65+#if PHP_MAJOR_VERSION >= 7
66+static zend_object *
67+#else
68 static zend_object_value
69+#endif
70 Gen_create_obj (zend_class_entry *type,
71- zend_objects_free_object_storage_t st, zend_object_handlers* handlers)
72+#if PHP_MAJOR_VERSION < 7
73+ zend_objects_free_object_storage_t st,
74+#endif
75+ zend_object_handlers* handlers)
76 {
77 TSRMLS_FETCH();
78+#if PHP_MAJOR_VERSION < 7
79 zend_object_value retval;
80+#endif
81
82- Proxy *obj = (Proxy *)emalloc(sizeof(Proxy));
83- memset(obj, 0, sizeof(Proxy));
84+#if PHP_MAJOR_VERSION >= 7
85+ Proxy *obj = (Proxy *)ecalloc(1, sizeof(Proxy) + zend_object_properties_size(type));
86+ zend_object_std_init(&obj->std, type);
87+#else
88+ Proxy *obj = (Proxy *)ecalloc(1, sizeof(Proxy));
89 obj->std.ce = type;
90+#endif
91
92 ALLOC_HASHTABLE(obj->std.properties);
93 zend_hash_init(obj->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
94@@ -176,10 +217,14 @@
95 object_properties_init(&(obj->std), type);
96 #endif
97
98+#if PHP_MAJOR_VERSION >= 7
99+ return &obj->std;
100+#else
101 retval.handle = zend_objects_store_put(obj, NULL, st, NULL TSRMLS_CC);
102 retval.handlers = handlers;
103
104 return retval;
105+#endif
106 }
107
108
109@@ -364,9 +409,15 @@
110
111 /* Serializer function for GEOSGeometry */
112
113+#if PHP_MAJOR_VERSION >= 7
114+static int
115+Geometry_serialize(zval *object, unsigned char **buffer, size_t *buf_len,
116+ zend_serialize_data *data TSRMLS_DC)
117+#else
118 static int
119 Geometry_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len,
120 zend_serialize_data *data TSRMLS_DC)
121+#endif
122 {
123 GEOSWKBWriter *serializer;
124 GEOSGeometry *geom;
125@@ -390,9 +441,15 @@
126 return SUCCESS;
127 }
128
129+#if PHP_MAJOR_VERSION >= 7
130+static int
131+Geometry_deserialize(zval *object, zend_class_entry *ce, const unsigned char *buf,
132+ size_t buf_len, zend_unserialize_data *data TSRMLS_DC)
133+#else
134 static int
135 Geometry_deserialize(zval **object, zend_class_entry *ce, const unsigned char *buf,
136 zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC)
137+#endif
138 {
139 GEOSWKBReader* deserializer;
140 GEOSGeometry* geom;
141@@ -406,8 +463,13 @@
142 "Geometry_deserialize called with unexpected zend_class_entry");
143 return FAILURE;
144 }
145+#if PHP_MAJOR_VERSION >= 7
146+ object_init_ex(object, ce);
147+ setRelay(object, geom);
148+#else
149 object_init_ex(*object, ce);
150 setRelay(*object, geom);
151+#endif
152
153 return SUCCESS;
154 }
155@@ -432,7 +494,11 @@
156 ngeoms = GEOSGetNumGeometries(g);
157 for (i=0; i<ngeoms; ++i)
158 {
159+#if PHP_MAJOR_VERSION >= 7
160+ zval tmp;
161+#else
162 zval *tmp;
163+#endif
164 GEOSGeometry* cc;
165 const GEOSGeometry* c = GEOSGetGeometryN(g, i);
166 if ( ! c ) continue; /* should get an exception */
167@@ -440,14 +506,30 @@
168 cc = GEOSGeom_clone(c);
169 if ( ! cc ) continue; /* should get an exception */
170
171+#if PHP_MAJOR_VERSION >= 7
172+ object_init_ex(&tmp, Geometry_ce_ptr);
173+ setRelay(&tmp, cc);
174+ add_next_index_zval(array, &tmp);
175+#else
176 MAKE_STD_ZVAL(tmp);
177 object_init_ex(tmp, Geometry_ce_ptr);
178 setRelay(tmp, cc);
179 add_next_index_zval(array, tmp);
180+#endif
181 }
182 }
183
184
185+#if PHP_MAJOR_VERSION >= 7
186+static void
187+Geometry_dtor (zend_object *object TSRMLS_DC)
188+{
189+ Proxy *obj = (Proxy *)((char*)object - XtOffsetOf(Proxy, std));
190+ GEOSGeom_destroy((GEOSGeometry*)obj->relay);
191+
192+ zend_object_std_dtor(object);
193+}
194+#else
195 static void
196 Geometry_dtor (void *object TSRMLS_DC)
197 {
198@@ -459,13 +541,21 @@
199
200 efree(obj);
201 }
202+#endif
203
204+#if PHP_MAJOR_VERSION >= 7
205+static zend_object *
206+Geometry_create_obj (zend_class_entry *type TSRMLS_DC)
207+{
208+ return Gen_create_obj(type, &Geometry_object_handlers);
209+}
210+#else
211 static zend_object_value
212 Geometry_create_obj (zend_class_entry *type TSRMLS_DC)
213 {
214 return Gen_create_obj(type, Geometry_dtor, &Geometry_object_handlers);
215 }
216-
217+#endif
218
219 PHP_METHOD(Geometry, __construct)
220 {
221@@ -500,7 +590,7 @@
222 ret = estrdup(wkt);
223 GEOSFree(wkt);
224
225- RETURN_STRING(ret, 0);
226+ PHP_RETURN_STRING(ret, 0);
227 }
228
229 PHP_METHOD(Geometry, project)
230@@ -595,10 +685,16 @@
231 double mitreLimit = default_mitreLimit;
232 long singleSided = 0;
233 zval *style_val = NULL;
234+#if PHP_MAJOR_VERSION >= 7
235+ zval *data;
236+ zend_string *key;
237+ zend_ulong index;
238+#else
239 zval **data;
240- HashTable *style;
241 char *key;
242 ulong index;
243+#endif
244+ HashTable *style;
245
246 this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr);
247
248@@ -612,37 +708,62 @@
249 if ( style_val )
250 {
251 style = HASH_OF(style_val);
252- while(zend_hash_get_current_key(style, &key, &index, 0)
253+ while(php_zend_hash_get_current_key(style, &key, &index, 0)
254 == HASH_KEY_IS_STRING)
255 {
256- if(!strcmp(key, "quad_segs"))
257+ if(!strcmp(PHP_KEY_VAL(key), "quad_segs"))
258 {
259+#if PHP_MAJOR_VERSION >= 7
260+ data = zend_hash_get_current_data(style);
261+ quadSegs = getZvalAsLong(data);
262+#else
263 zend_hash_get_current_data(style, (void**)&data);
264 quadSegs = getZvalAsLong(*data);
265+#endif
266 GEOSBufferParams_setQuadrantSegments(params, quadSegs);
267 }
268- else if(!strcmp(key, "endcap"))
269+ else if(!strcmp(PHP_KEY_VAL(key), "endcap"))
270 {
271+#if PHP_MAJOR_VERSION >= 7
272+ data = zend_hash_get_current_data(style);
273+ endCapStyle = getZvalAsLong(data);
274+#else
275 zend_hash_get_current_data(style, (void**)&data);
276 endCapStyle = getZvalAsLong(*data);
277+#endif
278 GEOSBufferParams_setEndCapStyle(params, endCapStyle);
279 }
280- else if(!strcmp(key, "join"))
281+ else if(!strcmp(PHP_KEY_VAL(key), "join"))
282 {
283+#if PHP_MAJOR_VERSION >= 7
284+ data = zend_hash_get_current_data(style);
285+ joinStyle = getZvalAsLong(data);
286+#else
287 zend_hash_get_current_data(style, (void**)&data);
288 joinStyle = getZvalAsLong(*data);
289+#endif
290 GEOSBufferParams_setJoinStyle(params, joinStyle);
291 }
292- else if(!strcmp(key, "mitre_limit"))
293+ else if(!strcmp(PHP_KEY_VAL(key), "mitre_limit"))
294 {
295+#if PHP_MAJOR_VERSION >= 7
296+ data = zend_hash_get_current_data(style);
297+ mitreLimit = getZvalAsDouble(data);
298+#else
299 zend_hash_get_current_data(style, (void**)&data);
300 mitreLimit = getZvalAsDouble(*data);
301+#endif
302 GEOSBufferParams_setMitreLimit(params, mitreLimit);
303 }
304- else if(!strcmp(key, "single_sided"))
305+ else if(!strcmp(PHP_KEY_VAL(key), "single_sided"))
306 {
307+#if PHP_MAJOR_VERSION >= 7
308+ data = zend_hash_get_current_data(style);
309+ singleSided = getZvalAsLong(data);
310+#else
311 zend_hash_get_current_data(style, (void**)&data);
312 singleSided = getZvalAsLong(*data);
313+#endif
314 GEOSBufferParams_setSingleSided(params, singleSided);
315 }
316
317@@ -687,10 +808,16 @@
318 long int joinStyle = default_joinStyle;
319 double mitreLimit = default_mitreLimit;
320 zval *style_val = NULL;
321+#if PHP_MAJOR_VERSION >= 7
322+ zval *data;
323+ zend_string *key;
324+ zend_ulong index;
325+#else
326 zval **data;
327- HashTable *style;
328 char *key;
329 ulong index;
330+#endif
331+ HashTable *style;
332
333 this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr);
334
335@@ -702,23 +829,38 @@
336 if ( style_val )
337 {
338 style = HASH_OF(style_val);
339- while(zend_hash_get_current_key(style, &key, &index, 0)
340+ while(php_zend_hash_get_current_key(style, &key, &index, 0)
341 == HASH_KEY_IS_STRING)
342 {
343- if(!strcmp(key, "quad_segs"))
344+ if(!strcmp(PHP_KEY_VAL(key), "quad_segs"))
345 {
346+#if PHP_MAJOR_VERSION >= 7
347+ data = zend_hash_get_current_data(style);
348+ quadSegs = getZvalAsLong(data);
349+#else
350 zend_hash_get_current_data(style, (void**)&data);
351 quadSegs = getZvalAsLong(*data);
352+#endif
353 }
354- else if(!strcmp(key, "join"))
355+ else if(!strcmp(PHP_KEY_VAL(key), "join"))
356 {
357+#if PHP_MAJOR_VERSION >= 7
358+ data = zend_hash_get_current_data(style);
359+ joinStyle = getZvalAsLong(data);
360+#else
361 zend_hash_get_current_data(style, (void**)&data);
362 joinStyle = getZvalAsLong(*data);
363+#endif
364 }
365- else if(!strcmp(key, "mitre_limit"))
366+ else if(!strcmp(PHP_KEY_VAL(key), "mitre_limit"))
367 {
368+#if PHP_MAJOR_VERSION >= 7
369+ data = zend_hash_get_current_data(style);
370+ mitreLimit = getZvalAsDouble(data);
371+#else
372 zend_hash_get_current_data(style, (void**)&data);
373 mitreLimit = getZvalAsDouble(*data);
374+#endif
375 }
376
377 zend_hash_move_forward(style);
378@@ -970,7 +1112,7 @@
379 if ( ! pat ) RETURN_NULL(); /* should get an exception first */
380 retStr = estrdup(pat);
381 GEOSFree(pat);
382- RETURN_STRING(retStr, 0);
383+ PHP_RETURN_STRING(retStr, 0);
384 } else {
385 retInt = GEOSRelatePattern(this, other, pat);
386 if ( retInt == 2 ) RETURN_NULL(); /* should get an exception first */
387@@ -1007,7 +1149,7 @@
388 if ( ! pat ) RETURN_NULL(); /* should get an exception first */
389 retStr = estrdup(pat);
390 GEOSFree(pat);
391- RETURN_STRING(retStr, 0);
392+ PHP_RETURN_STRING(retStr, 0);
393 }
394
395 /**
396@@ -1409,6 +1551,9 @@
397 char *reason = NULL;
398 zend_bool retBool;
399 char *reasonVal = NULL;
400+#if PHP_MAJOR_VERSION >= 7
401+ zval locationValS;
402+#endif
403 zval *locationVal = NULL;
404 long int flags = 0;
405
406@@ -1428,7 +1573,11 @@
407 }
408
409 if ( location ) {
410+#if PHP_MAJOR_VERSION >= 7
411+ locationVal = &locationValS;
412+#else
413 MAKE_STD_ZVAL(locationVal);
414+#endif
415 object_init_ex(locationVal, Geometry_ce_ptr);
416 setRelay(locationVal, location);
417 }
418@@ -1438,7 +1587,7 @@
419 /* return value is an array */
420 array_init(return_value);
421 add_assoc_bool(return_value, "valid", retBool);
422- if ( reasonVal ) add_assoc_string(return_value, "reason", reasonVal, 0);
423+ if ( reasonVal ) php_add_assoc_string(return_value, "reason", reasonVal, 0);
424 if ( locationVal ) add_assoc_zval(return_value, "location", locationVal);
425
426 }
427@@ -1538,7 +1687,7 @@
428 typVal = estrdup(typ);
429 GEOSFree(typ);
430
431- RETURN_STRING(typVal, 0);
432+ PHP_RETURN_STRING(typVal, 0);
433 }
434
435 /**
436@@ -1999,6 +2148,16 @@
437
438 static zend_object_handlers WKTReader_object_handlers;
439
440+#if PHP_MAJOR_VERSION >= 7
441+static void
442+WKTReader_dtor (zend_object *object TSRMLS_DC)
443+{
444+ Proxy *obj = (Proxy *)((char*)object - XtOffsetOf(Proxy, std));
445+ GEOSWKTReader_destroy((GEOSWKTReader*)obj->relay);
446+
447+ zend_object_std_dtor(object);
448+}
449+#else
450 static void
451 WKTReader_dtor (void *object TSRMLS_DC)
452 {
453@@ -2010,12 +2169,21 @@
454
455 efree(obj);
456 }
457+#endif
458
459+#if PHP_MAJOR_VERSION >= 7
460+static zend_object *
461+WKTReader_create_obj (zend_class_entry *type TSRMLS_DC)
462+{
463+ return Gen_create_obj(type, &WKTReader_object_handlers);
464+}
465+#else
466 static zend_object_value
467 WKTReader_create_obj (zend_class_entry *type TSRMLS_DC)
468 {
469 return Gen_create_obj(type, WKTReader_dtor, &WKTReader_object_handlers);
470 }
471+#endif
472
473
474 PHP_METHOD(WKTReader, __construct)
475@@ -2082,6 +2250,16 @@
476
477 static zend_object_handlers WKTWriter_object_handlers;
478
479+#if PHP_MAJOR_VERSION >= 7
480+static void
481+WKTWriter_dtor (zend_object *object TSRMLS_DC)
482+{
483+ Proxy *obj = (Proxy *)((char*)object - XtOffsetOf(Proxy, std));
484+ GEOSWKTWriter_destroy((GEOSWKTWriter*)obj->relay);
485+
486+ zend_object_std_dtor(object);
487+}
488+#else
489 static void
490 WKTWriter_dtor (void *object TSRMLS_DC)
491 {
492@@ -2093,12 +2271,21 @@
493
494 efree(obj);
495 }
496+#endif
497
498+#if PHP_MAJOR_VERSION >= 7
499+static zend_object *
500+WKTWriter_create_obj (zend_class_entry *type TSRMLS_DC)
501+{
502+ return Gen_create_obj(type, &WKTWriter_object_handlers);
503+}
504+#else
505 static zend_object_value
506 WKTWriter_create_obj (zend_class_entry *type TSRMLS_DC)
507 {
508 return Gen_create_obj(type, WKTWriter_dtor, &WKTWriter_object_handlers);
509 }
510+#endif
511
512 PHP_METHOD(WKTWriter, __construct)
513 {
514@@ -2139,7 +2326,7 @@
515 retstr = estrdup(wkt);
516 GEOSFree(wkt);
517
518- RETURN_STRING(retstr, 0);
519+ PHP_RETURN_STRING(retstr, 0);
520 }
521
522 PHP_METHOD(WKTWriter, setTrim)
523@@ -2257,6 +2444,16 @@
524
525 static zend_object_handlers WKBWriter_object_handlers;
526
527+#if PHP_MAJOR_VERSION >= 7
528+static void
529+WKBWriter_dtor (zend_object *object TSRMLS_DC)
530+{
531+ Proxy *obj = (Proxy *)((char*)object - XtOffsetOf(Proxy, std));
532+ GEOSWKBWriter_destroy((GEOSWKBWriter*)obj->relay);
533+
534+ zend_object_std_dtor(object);
535+}
536+#else
537 static void
538 WKBWriter_dtor (void *object TSRMLS_DC)
539 {
540@@ -2268,12 +2465,21 @@
541
542 efree(obj);
543 }
544+#endif
545
546+#if PHP_MAJOR_VERSION >= 7
547+static zend_object *
548+WKBWriter_create_obj (zend_class_entry *type TSRMLS_DC)
549+{
550+ return Gen_create_obj(type, &WKBWriter_object_handlers);
551+}
552+#else
553 static zend_object_value
554 WKBWriter_create_obj (zend_class_entry *type TSRMLS_DC)
555 {
556 return Gen_create_obj(type, WKBWriter_dtor, &WKBWriter_object_handlers);
557 }
558+#endif
559
560 /**
561 * GEOSWKBWriter w = new GEOSWKBWriter()
562@@ -2356,7 +2562,7 @@
563 retstr = estrndup(ret, retsize);
564 GEOSFree(ret);
565
566- RETURN_STRINGL(retstr, retsize, 0);
567+ PHP_RETURN_STRINGL(retstr, retsize, 0);
568 }
569
570 /**
571@@ -2388,7 +2594,7 @@
572 retstr = estrndup(ret, retsize);
573 GEOSFree(ret);
574
575- RETURN_STRING(retstr, 0);
576+ PHP_RETURN_STRING(retstr, 0);
577 }
578
579 /**
580@@ -2481,6 +2687,16 @@
581
582 static zend_object_handlers WKBReader_object_handlers;
583
584+#if PHP_MAJOR_VERSION >= 7
585+static void
586+WKBReader_dtor (zend_object *object TSRMLS_DC)
587+{
588+ Proxy *obj = (Proxy *)((char*)object - XtOffsetOf(Proxy, std));
589+ GEOSWKBReader_destroy((GEOSWKBReader*)obj->relay);
590+
591+ zend_object_std_dtor(object);
592+}
593+#else
594 static void
595 WKBReader_dtor (void *object TSRMLS_DC)
596 {
597@@ -2492,12 +2708,21 @@
598
599 efree(obj);
600 }
601+#endif
602
603+#if PHP_MAJOR_VERSION >= 7
604+static zend_object *
605+WKBReader_create_obj (zend_class_entry *type TSRMLS_DC)
606+{
607+ return Gen_create_obj(type, &WKBReader_object_handlers);
608+}
609+#else
610 static zend_object_value
611 WKBReader_create_obj (zend_class_entry *type TSRMLS_DC)
612 {
613 return Gen_create_obj(type, WKBReader_dtor, &WKBReader_object_handlers);
614 }
615+#endif
616
617
618 PHP_METHOD(WKBReader, __construct)
619@@ -2575,7 +2800,7 @@
620 char *str;
621
622 str = estrdup(GEOSversion());
623- RETURN_STRING(str, 0);
624+ PHP_RETURN_STRING(str, 0);
625 }
626
627 /**
628@@ -2608,7 +2833,11 @@
629 GEOSGeometry *cut_edges;
630 GEOSGeometry *dangles;
631 GEOSGeometry *invalid_rings;
632+#if PHP_MAJOR_VERSION >= 7
633+ zval array_elem;
634+#else
635 zval *array_elem;
636+#endif
637 zval *zobj;
638
639 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj)
640@@ -2624,11 +2853,36 @@
641 /* return value should be an array */
642 array_init(return_value);
643
644+#if PHP_MAJOR_VERSION >= 7
645+ ZVAL_NEW_ARR(&array_elem);
646+ array_init(&array_elem);
647+ dumpGeometry(rings, &array_elem);
648+ GEOSGeom_destroy(rings);
649+ add_assoc_zval(return_value, "rings", &array_elem);
650+
651+ ZVAL_NEW_ARR(&array_elem);
652+ array_init(&array_elem);
653+ dumpGeometry(cut_edges, &array_elem);
654+ GEOSGeom_destroy(cut_edges);
655+ add_assoc_zval(return_value, "cut_edges", &array_elem);
656+
657+ ZVAL_NEW_ARR(&array_elem);
658+ array_init(&array_elem);
659+ dumpGeometry(dangles, &array_elem);
660+ GEOSGeom_destroy(dangles);
661+ add_assoc_zval(return_value, "dangles", &array_elem);
662+
663+ ZVAL_NEW_ARR(&array_elem);
664+ array_init(&array_elem);
665+ dumpGeometry(invalid_rings, &array_elem);
666+ GEOSGeom_destroy(invalid_rings);
667+ add_assoc_zval(return_value, "invalid_rings", &array_elem);
668+#else
669 MAKE_STD_ZVAL(array_elem);
670 array_init(array_elem);
671 dumpGeometry(rings, array_elem);
672 GEOSGeom_destroy(rings);
673- add_assoc_zval(return_value, "rings", array_elem);
674+ add_assoc_zval(return_value, "rings", array_elem);
675
676 MAKE_STD_ZVAL(array_elem);
677 array_init(array_elem);
678@@ -2647,7 +2901,7 @@
679 dumpGeometry(invalid_rings, array_elem);
680 GEOSGeom_destroy(invalid_rings);
681 add_assoc_zval(return_value, "invalid_rings", array_elem);
682-
683+#endif
684 }
685
686 /**
687@@ -2813,6 +3067,9 @@
688 memcpy(&WKTReader_object_handlers,
689 zend_get_std_object_handlers(), sizeof(zend_object_handlers));
690 WKTReader_object_handlers.clone_obj = NULL;
691+#if PHP_MAJOR_VERSION >= 7
692+ WKTReader_object_handlers.free_obj = &WKTReader_dtor;
693+#endif
694
695 /* WKTWriter */
696 INIT_CLASS_ENTRY(ce, "GEOSWKTWriter", WKTWriter_methods);
697@@ -2821,6 +3078,9 @@
698 memcpy(&WKTWriter_object_handlers,
699 zend_get_std_object_handlers(), sizeof(zend_object_handlers));
700 WKTWriter_object_handlers.clone_obj = NULL;
701+#if PHP_MAJOR_VERSION >= 7
702+ WKTWriter_object_handlers.free_obj = &WKTWriter_dtor;
703+#endif
704
705 /* Geometry */
706 INIT_CLASS_ENTRY(ce, "GEOSGeometry", Geometry_methods);
707@@ -2829,6 +3089,9 @@
708 memcpy(&Geometry_object_handlers,
709 zend_get_std_object_handlers(), sizeof(zend_object_handlers));
710 Geometry_object_handlers.clone_obj = NULL;
711+#if PHP_MAJOR_VERSION >= 7
712+ Geometry_object_handlers.free_obj = &Geometry_dtor;
713+#endif
714 /* Geometry serialization */
715 Geometry_ce_ptr->serialize = Geometry_serialize;
716 Geometry_ce_ptr->unserialize = Geometry_deserialize;
717@@ -2840,6 +3103,9 @@
718 memcpy(&WKBWriter_object_handlers,
719 zend_get_std_object_handlers(), sizeof(zend_object_handlers));
720 WKBWriter_object_handlers.clone_obj = NULL;
721+#if PHP_MAJOR_VERSION >= 7
722+ WKBWriter_object_handlers.free_obj = &WKBWriter_dtor;
723+#endif
724
725 /* WKBReader */
726 INIT_CLASS_ENTRY(ce, "GEOSWKBReader", WKBReader_methods);
727@@ -2848,6 +3114,9 @@
728 memcpy(&WKBReader_object_handlers,
729 zend_get_std_object_handlers(), sizeof(zend_object_handlers));
730 WKBReader_object_handlers.clone_obj = NULL;
731+#if PHP_MAJOR_VERSION >= 7
732+ WKBReader_object_handlers.free_obj = &WKBReader_dtor;
733+#endif
734
735
736 /* Constants */
This page took 0.16379 seconds and 4 git commands to generate.