diff --git a/CREDITS b/CREDITS index 0c6410d..571227c 100644 --- a/CREDITS +++ b/CREDITS @@ -1,3 +1,3 @@ geos -Sandro Santilli - GEOS -J Smith - PHP packaging +Sandro Santilli strk@kbt.io - GEOS +J Smith dark.panda@gmail.com jay@php.net - PHP packaging diff --git a/README.md b/README.md index 5e32c9c..bf88f60 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,82 @@ -PHP module for GEOS -=================== +# PHP module for GEOS -[![build status] -(https://drone.osgeo.org/api/badges/geos/php-geos/status.svg?branch=master)] -(https://drone.osgeo.org/geos/php-geos?branch=master) +[![build status](https://dronie.osgeo.org/api/badges/geos/php-geos/status.svg?branch=master)](https://github.com/libgeos/php-geos/tree/master) The code in this directory provides a PHP module to make use -of functionalities of the [GEOS library] (http://geos.osgeo.org). +of functionalities of the [GEOS library](http://geos.osgeo.org). The bindings are linked to the C-API, for betters stability. -# Building +## Building (UNIX) -## Requirements +### Requirements You need: - - PHP development files - ( often found in packages named something like 'php5-dev' ) +- PHP development files + ( often found in packages named something like 'php5-dev' ) - - GEOS development files - ( often found in packages named something like 'libgeos-dev' ) +- GEOS development files + ( often found in packages named something like 'libgeos-dev' ) -## Procedure +### Procedure - git clone https://git.osgeo.org/gitea/geos/php-geos.git + git clone https://github.com/libgeos/php-geos.git cd php-geos ./autogen.sh ./configure make # generates modules/geos.so -# Testing +## Building (Windows) + +### Requirements + +- PHP source files: download [zip](http://windows.php.net/download/) or clone from [github](https://github.com/php/php-src) +- PHP SDK ( https://github.com/Microsoft/php-sdk-binary-tools ) +- Visual C++: + * Visual C++ 14.0 (Visual Studio 2015) for PHP 7.0 or PHP 7.1. + * Visual C++ 15.0 (Visual Studio 2017) for PHP 7.2, PHP 7.3 or PHP 7.4. + * Visual C++ 16.0 (Visual Studio 2019) for master. +- GEOS Windows binaries (binary dll, includes and lib): + * As part of [OSGeo4W](http://osgeo4w.osgeo.org/) as part of the geos package. + * As part of [MS4W](https://ms4w.com/) + +### Configure + +Official instructions for compiling PHP extensions: https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2 + +1. Install OSGeo4w in `C:\OSGeo4W64` and PHP-SDK in `C:/php-sdk.` +2. Invoke the starter script, for example for Visual Studio 2015 64-bit build, invoke phpsdk-vc15-x64.bat +3. Run the phpsdk_buildtree batch script which will create the desired directory structure: + + phpsdk_buildtree phpdev + + The phpsdk_buildtree script will create the path according to the currently VC++ version used and switch into the newly created directory +4. Extract the PHP source code to `C:\php-sdk\phpdev\vX##\x##`, where: + + vX## is the compiler version you are using (eq vc15 or vs16) + x## is your architecture (x86 or x64) + For example: `C:\php-sdk\phpdev\vc15\x64\php-7.4.11-src` + In the same directory where you extracted the PHP source there is a deps directory. + For example: `C:\php-sdk\phpdev\vc15\x64\deps` + +5. Copy GEOS binaries from `C:\OSGeo4W64` (`bin`, `include` and `lib` subdir) to `C:\php-sdk\phpdev\vc15\x64\deps\` +6. Copy (clone) code from this repository to `C:\php-sdk\phpdev\vc15\x64\php-7.4.11-src\ext\geos` + + +### Compile + +Run next commands to compile ([see official php instruction](https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2)): + + c:\php-sdk\phpsdk-vc15-x64.bat + cd C:\php-sdk\phpdev\vc15\x64\php-7.4.11-src + buildconf + configure --disable-all --enable-cli --with-geos + nmake + + + +## Testing Automated testing is executed on 'make check'. @@ -38,15 +84,19 @@ You'll need phpunit installed for this to work. To install: pear install --force --alldeps phpunit/phpunit -# Installing +## Installing + +### Unix As root (or owner with write access to the directory returned by php-config --extension-dir), run: make install -# Using +### Window +Copy php_geos.dll to extension directory and enable it in php.ini + +## Using ... TODO ... (reference some automatically built doc?) - diff --git a/config.w32 b/config.w32 new file mode 100644 index 0000000..6a0f0cc --- /dev/null +++ b/config.w32 @@ -0,0 +1,59 @@ +// vim:ft=javascript + +ARG_WITH("geos", "geos support", "yes"); + +if (PHP_GEOS != "no") { + if (CHECK_LIB("geos_c.lib", "geos", PHP_GEOS) && + CHECK_HEADER_ADD_INCLUDE("geos_c.h", "CFLAGS_GEOS", PHP_GEOS)) { + + CHECK_LIB("geos_c.lib", "initGEOS_r", PHP_GEOS) && !PHP_GEOS && WARNING("Unable to build the GEOS: a newer libgeos is required"); + + CHECK_LIB("geos_c.lib", "GEOSClipByRect_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_CLIP_BY_RECT', 1, 'Whether we have GEOSClipByRect_r'); + CHECK_LIB("geos_c.lib", "GEOSCoveredBy_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_COVERED_BY', 1, 'Whether we have GEOSCoveredBy_r'); + CHECK_LIB("geos_c.lib", "GEOSCovers_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_COVERS', 1, 'Whether we have GEOSCovers_r'); + CHECK_LIB("geos_c.lib", "GEOSDelaunayTriangulation_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_DELAUNAY_TRIANGULATION', 1, 'Whether we have GEOSDelaunayTriangulation_r'); + CHECK_LIB("geos_c.lib", "GEOSGeomGetEndPoint_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_END_POINT', 1, 'Whether we have GEOSGeomGetEndPoint_r'); + CHECK_LIB("geos_c.lib", "GEOSGeomGetNumPoints_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_NUM_POINTS', 1, 'Whether we have GEOSGeomGetNumPoints_r'); + CHECK_LIB("geos_c.lib", "GEOSGeomGetPointN_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_POINT_N', 1, 'Whether we have GEOSGeomGetPointN_r'); + CHECK_LIB("geos_c.lib", "GEOSGeomGetStartPoint_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_START_POINT', 1, 'Whether we have GEOSGeomGetStartPoint_r'); + CHECK_LIB("geos_c.lib", "GEOSGeomGetX_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_X', 1, 'Whether we have GEOSGeomGetX_r'); + CHECK_LIB("geos_c.lib", "GEOSGeomGetY_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_Y', 1, 'Whether we have GEOSGeomGetY_r'); + CHECK_LIB("geos_c.lib", "GEOSGeom_extractUniquePoints_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_EXTRACT_UNIQUE_POINTS', 1, 'Whether we have GEOSGeom_extractUniquePoints_r'); + CHECK_LIB("geos_c.lib", "GEOSGeom_getCoordinateDimension_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_COORDINATE_DIMENSION', 1, 'Whether we have GEOSGeom_getCoordinateDimension_r'); + CHECK_LIB("geos_c.lib", "GEOSNode_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_NODE', 1, 'Whether we have GEOSNode_r'); + CHECK_LIB("geos_c.lib", "GEOSOffsetCurve_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_OFFSET_CURVE', 1, 'Whether we have GEOSOffsetCurve_r'); + CHECK_LIB("geos_c.lib", "GEOSPolygonize_full_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_POLYGONIZE_FULL', 1, 'Whether we have GEOSPolygonize_full_r'); + CHECK_LIB("geos_c.lib", "GEOSRelateBoundaryNodeRule_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_RELATE_BOUNDARY_NODE_RULE', 1, 'Whether we have GEOSRelateBoundaryNodeRule_r'); + CHECK_LIB("geos_c.lib", "GEOSRelatePatternMatch_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_RELATE_PATTERN_MATCH', 1, 'Whether we have GEOSRelatePatternMatch_r'); + CHECK_LIB("geos_c.lib", "GEOSSharedPaths_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_SHARED_PATHS', 1, 'Whether we have GEOSSharedPaths_r'); + CHECK_LIB("geos_c.lib", "GEOSSnap_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_SNAP', 1, 'Whether we have GEOSSnap_r'); + CHECK_LIB("geos_c.lib", "GEOSUnaryUnion_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_UNARY_UNION', 1, 'Whether we have GEOSUnaryUnion_r'); + CHECK_LIB("geos_c.lib", "GEOSVoronoiDiagram_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_VORONOI_DIAGRAM', 1, 'Whether we have GEOSVoronoiDiagram_r'); + CHECK_LIB("geos_c.lib", "GEOSisClosed_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_IS_CLOSED', 1, 'Whether we have GEOSisClosed_r'); + CHECK_LIB("geos_c.lib", "GEOSisValidDetail_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_IS_VALID_DETAIL', 1, 'Whether we have GEOSisValidDetail_r'); + CHECK_LIB("geos_c.lib", "GEOSGeom_setPrecision_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_SET_PRECISION', 1, 'Whether we have GEOSGeom_setPrecision_r'); + CHECK_LIB("geos_c.lib", "GEOSGeom_getPrecision_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_PRECISION', 1, 'Whether we have GEOSGeom_getPrecision_r'); + + CHECK_LIB("geos_c.lib", "GEOSWKTWriter_setTrim_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_TRIM', 1, 'Whether we have GEOSWKTWriter_setTrim_r'); + CHECK_LIB("geos_c.lib", "GEOSWKTWriter_setRoundingPrecision_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_ROUNDING_PRECISION', 1, 'Whether we have GEOSWKTWriter_setRoundingPrecision_r'); + CHECK_LIB("geos_c.lib", "GEOSWKTWriter_setOutputDimension_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_OUTPUT_DIMENSION', 1, 'Whether we have GEOSWKTWriter_setOutputDimension_r'); + CHECK_LIB("geos_c.lib", "GEOSWKTWriter_getOutputDimension_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_GET_OUTPUT_DIMENSION', 1, 'Whether we have GEOSWKTWriter_getOutputDimension_r'); + CHECK_LIB("geos_c.lib", "GEOSWKTWriter_setOld3D_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_OLD_3D', 1, 'Whether we have GEOSWKTWriter_setOld3D_r'); + + // https://juliahub.com/docs/LibGEOS/we91k/0.6.5/autodocs/ + // setPrecision: GEOS_PREC_NO_TOPO -- do not attempt at preserving the topology -- geos.c l. 3379 + // setPrecision: GEOS_PREC_KEEP_COLLAPSED -- retain collapsed elements -- geos.c l. 3384 + // We can't run TRY_COMPILE tests on Windows ?? force HAVE_GEOS_PREC_NO_TOPO & HAVE_GEOS_PREC_KEEP_COLLAPSED + // AC_TRY_COMPILE(geos_c.h, GEOS_PREC_NO_TOPO, AC_DEFINE(HAVE_GEOS_PREC_NO_TOPO,1,[Whether we have GEOS_PREC_NO_TOPO])) -- do not attempt at preserving the topology + // AC_TRY_COMPILE(geos_c.h, GEOS_PREC_KEEP_COLLAPSED, AC_DEFINE(HAVE_GEOS_PREC_KEEP_COLLAPSED,1,[Whether we have GEOS_PREC_KEEP_COLLAPSED])) -- retain collapsed elements + AC_DEFINE('HAVE_GEOS_PREC_NO_TOPO',1,'Whether we have GEOS_PREC_NO_TOPO'); + AC_DEFINE('HAVE_GEOS_PREC_KEEP_COLLAPSED',1,'Whether we have GEOS_PREC_KEEP_COLLAPSED'); + + EXTENSION("geos", "geos.c", 1); + + } else { + WARNING("geos support can't be enabled, libraries or headers are missing") + PHP_GEOS = "no"; + } + +} diff --git a/geos.c b/geos.c index 2c81428..73dddd7 100755 --- a/geos.c +++ b/geos.c @@ -33,6 +33,9 @@ /* Own stuff */ #include "php_geos.h" +ZEND_BEGIN_ARG_INFO_EX(arginfo_void, 0, 0, 0) +ZEND_END_ARG_INFO() + static ZEND_DECLARE_MODULE_GLOBALS(geos); static PHP_GINIT_FUNCTION(geos); @@ -84,16 +87,16 @@ 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_void) + PHP_FE(GEOSPolygonize, arginfo_void) + PHP_FE(GEOSLineMerge, arginfo_void) # ifdef HAVE_GEOS_SHARED_PATHS - PHP_FE(GEOSSharedPaths, NULL) + PHP_FE(GEOSSharedPaths, arginfo_void) # endif # ifdef HAVE_GEOS_RELATE_PATTERN_MATCH - PHP_FE(GEOSRelateMatch, NULL) + PHP_FE(GEOSRelateMatch, arginfo_void) # endif {NULL, NULL, NULL} }; @@ -123,19 +126,19 @@ ZEND_GET_MODULE(geos) static void noticeHandler(const char *fmt, ...) { - TSRMLS_FETCH(); + char message[256]; va_list args; va_start(args, fmt); vsnprintf(message, sizeof(message) - 1, fmt, args); va_end(args); - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", message); + php_error_docref(NULL, E_NOTICE, "%s", message); } static void errorHandler(const char *fmt, ...) { - TSRMLS_FETCH(); + char message[256]; va_list args; va_start(args, fmt); @@ -143,8 +146,8 @@ static void errorHandler(const char *fmt, ...) va_end(args); /* TODO: use a GEOSException ? */ - zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), - 1 TSRMLS_CC, "%s", message); + zend_throw_exception_ex(zend_exception_get_default(), + 1, "%s", message); } @@ -166,15 +169,15 @@ static inline Proxy *php_geos_fetch_object(zend_object *obj) { # define Z_GEOS_OBJ_P(zv) (Proxy *)((char *) (Z_OBJ_P(zv)) - XtOffsetOf(Proxy, std)) #else # ifdef Z_OBJ -# define Z_GEOS_OBJ_P(zv) (Proxy*)Z_OBJ(*val TSRMLS_CC) +# define Z_GEOS_OBJ_P(zv) (Proxy*)Z_OBJ(*val) # else -# define Z_GEOS_OBJ_P(zv) (Proxy*)zend_object_store_get_object(val TSRMLS_CC) +# define Z_GEOS_OBJ_P(zv) (Proxy*)zend_object_store_get_object(val) # endif #endif static void setRelay(zval* val, void* obj) { - TSRMLS_FETCH(); + Proxy* proxy = Z_GEOS_OBJ_P(val); @@ -183,17 +186,25 @@ setRelay(zval* val, void* obj) { static inline void * getRelay(zval* val, zend_class_entry* ce) { - TSRMLS_FETCH(); + Proxy* proxy = Z_GEOS_OBJ_P(val); if ( proxy->std.ce != ce ) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, +#if PHP_VERSION_ID >= 70000 + "Relay object is not an %s", ZSTR_VAL(ce->name)); +#else "Relay object is not an %s", ce->name); +#endif } if ( ! proxy->relay ) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, +#if PHP_VERSION_ID >= 70000 + "Relay object for object of type %s is not set", ZSTR_VAL(ce->name)); +#else "Relay object for object of type %s is not set", ce->name); +#endif } return proxy->relay; } @@ -234,16 +245,16 @@ static long getZvalAsDouble(GEOS_PHP_ZVAL val) static zend_object_value Gen_create_obj (zend_class_entry *type, - void (*dtor)(GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC), + void (*dtor)(GEOS_PHP_DTOR_OBJECT *object), zend_object_handlers* handlers) { - TSRMLS_FETCH(); + #if PHP_VERSION_ID >= 70000 Proxy *obj = (Proxy *) ecalloc(1, sizeof(Proxy) + zend_object_properties_size(type)); - zend_object_std_init(&obj->std, type TSRMLS_CC); + zend_object_std_init(&obj->std, type); object_properties_init(&obj->std, type); obj->std.handlers = handlers; @@ -270,7 +281,7 @@ Gen_create_obj (zend_class_entry *type, object_properties_init(&(obj->std), type); #endif - retval.handle = zend_objects_store_put(obj, NULL, dtor, NULL TSRMLS_CC); + retval.handle = zend_objects_store_put(obj, NULL, dtor, NULL); retval.handlers = handlers; return retval; @@ -420,142 +431,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_void, 0) + PHP_ME(Geometry, __toString, arginfo_void, 0) + PHP_ME(Geometry, project, arginfo_void, 0) + PHP_ME(Geometry, interpolate, arginfo_void, 0) + PHP_ME(Geometry, buffer, arginfo_void, 0) # ifdef HAVE_GEOS_OFFSET_CURVE - PHP_ME(Geometry, offsetCurve, NULL, 0) + PHP_ME(Geometry, offsetCurve, arginfo_void, 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_void, 0) + PHP_ME(Geometry, intersection, arginfo_void, 0) + PHP_ME(Geometry, convexHull, arginfo_void, 0) + PHP_ME(Geometry, difference, arginfo_void, 0) + PHP_ME(Geometry, symDifference, arginfo_void, 0) + PHP_ME(Geometry, boundary, arginfo_void, 0) + PHP_ME(Geometry, union, arginfo_void, 0) + PHP_ME(Geometry, pointOnSurface, arginfo_void, 0) + PHP_ME(Geometry, centroid, arginfo_void, 0) + PHP_ME(Geometry, relate, arginfo_void, 0) # ifdef HAVE_GEOS_RELATE_BOUNDARY_NODE_RULE - PHP_ME(Geometry, relateBoundaryNodeRule, NULL, 0) + PHP_ME(Geometry, relateBoundaryNodeRule, arginfo_void, 0) # endif - PHP_ME(Geometry, simplify, NULL, 0) - PHP_ME(Geometry, normalize, NULL, 0) + PHP_ME(Geometry, simplify, arginfo_void, 0) + PHP_ME(Geometry, normalize, arginfo_void, 0) # ifdef HAVE_GEOS_GEOM_SET_PRECISION - PHP_ME(Geometry, setPrecision, NULL, 0) + PHP_ME(Geometry, setPrecision, arginfo_void, 0) # endif # if HAVE_GEOS_GEOM_GET_PRECISION - PHP_ME(Geometry, getPrecision, NULL, 0) + PHP_ME(Geometry, getPrecision, arginfo_void, 0) # endif # ifdef HAVE_GEOS_GEOM_EXTRACT_UNIQUE_POINTS - PHP_ME(Geometry, extractUniquePoints, NULL, 0) + PHP_ME(Geometry, extractUniquePoints, arginfo_void, 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_void, 0) + PHP_ME(Geometry, touches, arginfo_void, 0) + PHP_ME(Geometry, intersects, arginfo_void, 0) + PHP_ME(Geometry, crosses, arginfo_void, 0) + PHP_ME(Geometry, within, arginfo_void, 0) + PHP_ME(Geometry, contains, arginfo_void, 0) + PHP_ME(Geometry, overlaps, arginfo_void, 0) # ifdef HAVE_GEOS_COVERS - PHP_ME(Geometry, covers, NULL, 0) + PHP_ME(Geometry, covers, arginfo_void, 0) # endif # ifdef HAVE_GEOS_COVERED_BY - PHP_ME(Geometry, coveredBy, NULL, 0) + PHP_ME(Geometry, coveredBy, arginfo_void, 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_void, 0) + PHP_ME(Geometry, equalsExact, arginfo_void, 0) + PHP_ME(Geometry, isEmpty, arginfo_void, 0) # ifdef HAVE_GEOS_IS_VALID_DETAIL - PHP_ME(Geometry, checkValidity, NULL, 0) + PHP_ME(Geometry, checkValidity, arginfo_void, 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_void, 0) + PHP_ME(Geometry, isRing, arginfo_void, 0) + PHP_ME(Geometry, hasZ, arginfo_void, 0) # ifdef HAVE_GEOS_IS_CLOSED - PHP_ME(Geometry, isClosed, NULL, 0) + PHP_ME(Geometry, isClosed, arginfo_void, 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_void, 0) + PHP_ME(Geometry, typeId, arginfo_void, 0) + PHP_ME(Geometry, getSRID, arginfo_void, 0) + PHP_ME(Geometry, setSRID, arginfo_void, 0) + PHP_ME(Geometry, numGeometries, arginfo_void, 0) + PHP_ME(Geometry, geometryN, arginfo_void, 0) + PHP_ME(Geometry, numInteriorRings, arginfo_void, 0) # ifdef HAVE_GEOS_GEOM_GET_NUM_POINTS - PHP_ME(Geometry, numPoints, NULL, 0) + PHP_ME(Geometry, numPoints, arginfo_void, 0) # endif # ifdef HAVE_GEOS_GEOM_GET_X - PHP_ME(Geometry, getX, NULL, 0) + PHP_ME(Geometry, getX, arginfo_void, 0) # endif # ifdef HAVE_GEOS_GEOM_GET_Y - PHP_ME(Geometry, getY, NULL, 0) + PHP_ME(Geometry, getY, arginfo_void, 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_void, 0) + PHP_ME(Geometry, exteriorRing, arginfo_void, 0) + PHP_ME(Geometry, numCoordinates, arginfo_void, 0) + PHP_ME(Geometry, dimension, arginfo_void, 0) # ifdef HAVE_GEOS_GEOM_GET_COORDINATE_DIMENSION - PHP_ME(Geometry, coordinateDimension, NULL, 0) + PHP_ME(Geometry, coordinateDimension, arginfo_void, 0) # endif # ifdef HAVE_GEOS_GEOM_GET_POINT_N - PHP_ME(Geometry, pointN, NULL, 0) + PHP_ME(Geometry, pointN, arginfo_void, 0) # endif # ifdef HAVE_GEOS_GEOM_GET_START_POINT - PHP_ME(Geometry, startPoint, NULL, 0) + PHP_ME(Geometry, startPoint, arginfo_void, 0) # endif # ifdef HAVE_GEOS_GEOM_GET_END_POINT - PHP_ME(Geometry, endPoint, NULL, 0) + PHP_ME(Geometry, endPoint, arginfo_void, 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_void, 0) + PHP_ME(Geometry, length, arginfo_void, 0) + PHP_ME(Geometry, distance, arginfo_void, 0) + PHP_ME(Geometry, hausdorffDistance, arginfo_void, 0) # if HAVE_GEOS_SNAP - PHP_ME(Geometry, snapTo, NULL, 0) + PHP_ME(Geometry, snapTo, arginfo_void, 0) # endif # ifdef HAVE_GEOS_NODE - PHP_ME(Geometry, node, NULL, 0) + PHP_ME(Geometry, node, arginfo_void, 0) # endif # ifdef HAVE_GEOS_DELAUNAY_TRIANGULATION - PHP_ME(Geometry, delaunayTriangulation, NULL, 0) + PHP_ME(Geometry, delaunayTriangulation, arginfo_void, 0) # endif # ifdef HAVE_GEOS_VORONOI_DIAGRAM - PHP_ME(Geometry, voronoiDiagram, NULL, 0) + PHP_ME(Geometry, voronoiDiagram, arginfo_void, 0) # endif # ifdef HAVE_GEOS_CLIP_BY_RECT - PHP_ME(Geometry, clipByRect, NULL, 0) + PHP_ME(Geometry, clipByRect, arginfo_void, 0) # endif {NULL, NULL, NULL} @@ -571,7 +582,7 @@ static GEOSWKBWriter* Geometry_serializer = 0; static GEOSWKBWriter* getGeometrySerializer() { - TSRMLS_FETCH(); + if ( ! Geometry_serializer ) { Geometry_serializer = GEOSWKBWriter_create_r(GEOS_G(handle)); @@ -583,7 +594,7 @@ static GEOSWKBWriter* getGeometrySerializer() static void delGeometrySerializer() { - TSRMLS_FETCH(); + if ( Geometry_serializer ) { GEOSWKBWriter_destroy_r(GEOS_G(handle), Geometry_serializer); @@ -596,7 +607,7 @@ static GEOSWKBReader* Geometry_deserializer = 0; static GEOSWKBReader* getGeometryDeserializer() { - TSRMLS_FETCH(); + if ( ! Geometry_deserializer ) { Geometry_deserializer = GEOSWKBReader_create_r(GEOS_G(handle)); @@ -606,7 +617,7 @@ static GEOSWKBReader* getGeometryDeserializer() static void delGeometryDeserializer() { - TSRMLS_FETCH(); + if ( Geometry_deserializer ) { GEOSWKBReader_destroy_r(GEOS_G(handle), Geometry_deserializer); @@ -617,7 +628,7 @@ static void delGeometryDeserializer() static int Geometry_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, - zend_serialize_data *data TSRMLS_DC) + zend_serialize_data *data) { GEOSWKBWriter *serializer; GEOSGeometry *geom; @@ -643,7 +654,7 @@ Geometry_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, static int Geometry_deserialize(GEOS_PHP_ZVAL object, zend_class_entry *ce, const unsigned char *buf, - zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) + zend_uint buf_len, zend_unserialize_data *data) { GEOSWKBReader* deserializer; GEOSGeometry* geom; @@ -653,7 +664,7 @@ Geometry_deserialize(GEOS_PHP_ZVAL object, zend_class_entry *ce, const unsigned /* check zend_class_entry being what we expect! */ if ( ce != Geometry_ce_ptr ) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, "Geometry_deserialize called with unexpected zend_class_entry"); return FAILURE; } @@ -677,7 +688,7 @@ Geometry_deserialize(GEOS_PHP_ZVAL object, zend_class_entry *ce, const unsigned static void dumpGeometry(GEOSGeometry* g, zval* array) { - TSRMLS_FETCH(); + int ngeoms, i; ngeoms = GEOSGetNumGeometries_r(GEOS_G(handle), g); @@ -703,7 +714,7 @@ dumpGeometry(GEOSGeometry* g, zval* array) static void -Geometry_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) +Geometry_dtor (GEOS_PHP_DTOR_OBJECT *object) { #if PHP_VERSION_ID < 70000 Proxy *obj = (Proxy *)object; @@ -724,7 +735,7 @@ Geometry_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) } static zend_object_value -Geometry_create_obj (zend_class_entry *type TSRMLS_DC) +Geometry_create_obj (zend_class_entry *type) { return Gen_create_obj(type, Geometry_dtor, &Geometry_object_handlers); } @@ -732,7 +743,7 @@ Geometry_create_obj (zend_class_entry *type TSRMLS_DC) PHP_METHOD(Geometry, __construct) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, "GEOSGeometry can't be constructed using new, check WKTReader"); } @@ -778,7 +789,7 @@ PHP_METHOD(Geometry, project) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|b", &zobj, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|b", &zobj, &normalized) == FAILURE) { RETURN_NULL(); } @@ -803,7 +814,7 @@ PHP_METHOD(Geometry, interpolate) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|b", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "d|b", &dist, &normalized) == FAILURE) { RETURN_NULL(); } @@ -863,11 +874,11 @@ PHP_METHOD(Geometry, buffer) GEOS_PHP_ZVAL data; HashTable *style; zend_string *key; - ulong index; + zend_ulong index; this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|a", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "d|a", &dist, &style_val) == FAILURE) { RETURN_NULL(); } @@ -956,11 +967,11 @@ PHP_METHOD(Geometry, offsetCurve) GEOS_PHP_ZVAL data; HashTable *style; zend_string *key; - ulong index; + zend_ulong index; this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|a", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "d|a", &dist, &style_val) == FAILURE) { RETURN_NULL(); } @@ -1024,7 +1035,7 @@ PHP_METHOD(Geometry, intersection) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1050,7 +1061,7 @@ PHP_METHOD(Geometry, clipByRect) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "dddd", &xmin, &ymin, &xmax, &ymax) == FAILURE) { RETURN_NULL(); } @@ -1088,7 +1099,7 @@ PHP_METHOD(Geometry, difference) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1111,7 +1122,7 @@ PHP_METHOD(Geometry, symDifference) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1153,7 +1164,7 @@ PHP_METHOD(Geometry, union) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1233,7 +1244,7 @@ PHP_METHOD(Geometry, relate) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|s", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|s", &zobj, &pat, &patlen) == FAILURE) { RETURN_NULL(); @@ -1272,7 +1283,7 @@ PHP_METHOD(Geometry, relateBoundaryNodeRule) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ol", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ol", &zobj, &bnr) == FAILURE) { RETURN_NULL(); @@ -1302,7 +1313,7 @@ PHP_METHOD(Geometry, simplify) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|b", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "d|b", &tolerance, &preserveTopology) == FAILURE) { RETURN_NULL(); } @@ -1333,7 +1344,7 @@ PHP_METHOD(Geometry, setPrecision) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|l", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "d|l", &gridSize, &flags) == FAILURE) { RETURN_NULL(); } @@ -1420,7 +1431,7 @@ PHP_METHOD(Geometry, disjoint) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1447,7 +1458,7 @@ PHP_METHOD(Geometry, touches) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1474,7 +1485,7 @@ PHP_METHOD(Geometry, intersects) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1501,7 +1512,7 @@ PHP_METHOD(Geometry, crosses) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1528,7 +1539,7 @@ PHP_METHOD(Geometry, within) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1555,7 +1566,7 @@ PHP_METHOD(Geometry, contains) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1582,7 +1593,7 @@ PHP_METHOD(Geometry, overlaps) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1610,7 +1621,7 @@ PHP_METHOD(Geometry, covers) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1639,7 +1650,7 @@ PHP_METHOD(Geometry, coveredBy) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1667,7 +1678,7 @@ PHP_METHOD(Geometry, equals) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1696,7 +1707,7 @@ PHP_METHOD(Geometry, equalsExact) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|d", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|d", &zobj, &tolerance) == FAILURE) { RETURN_NULL(); } @@ -1746,7 +1757,7 @@ PHP_METHOD(Geometry, checkValidity) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flags) == FAILURE) { RETURN_NULL(); } @@ -1919,7 +1930,7 @@ PHP_METHOD(Geometry, setSRID) geom = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &srid) == FAILURE) { RETURN_NULL(); } @@ -1955,7 +1966,7 @@ PHP_METHOD(Geometry, geometryN) geom = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &num) == FAILURE) { RETURN_NULL(); } @@ -2054,7 +2065,7 @@ PHP_METHOD(Geometry, interiorRingN) geom = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &num) == FAILURE) { RETURN_NULL(); } @@ -2152,7 +2163,7 @@ PHP_METHOD(Geometry, pointN) geom = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &num) == FAILURE) { RETURN_NULL(); } @@ -2247,7 +2258,7 @@ PHP_METHOD(Geometry, distance) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); @@ -2274,7 +2285,7 @@ PHP_METHOD(Geometry, hausdorffDistance) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); @@ -2299,7 +2310,7 @@ PHP_METHOD(Geometry, snapTo) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "od", &zobj, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "od", &zobj, &tolerance) == FAILURE) { RETURN_NULL(); } @@ -2339,8 +2350,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_void, 0) + PHP_ME(WKTReader, read, arginfo_void, 0) {NULL, NULL, NULL} }; @@ -2349,7 +2360,7 @@ static zend_class_entry *WKTReader_ce_ptr; static zend_object_handlers WKTReader_object_handlers; static void -WKTReader_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) +WKTReader_dtor (GEOS_PHP_DTOR_OBJECT *object) { #if PHP_VERSION_ID < 70000 Proxy *obj = (Proxy *)object; @@ -2371,7 +2382,7 @@ WKTReader_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) } static zend_object_value -WKTReader_create_obj (zend_class_entry *type TSRMLS_DC) +WKTReader_create_obj (zend_class_entry *type) { return Gen_create_obj(type, WKTReader_dtor, &WKTReader_object_handlers); } @@ -2384,7 +2395,7 @@ PHP_METHOD(WKTReader, __construct) obj = GEOSWKTReader_create_r(GEOS_G(handle)); if ( ! obj ) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, "GEOSWKTReader_create() failed (didn't initGEOS?)"); } @@ -2402,7 +2413,7 @@ PHP_METHOD(WKTReader, read) reader = (GEOSWKTReader*)getRelay(getThis(), WKTReader_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), #if PHP_VERSION_ID >= 70000 "S", &wkt #else @@ -2449,27 +2460,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_void, 0) + PHP_ME(WKTWriter, write, arginfo_void, 0) # ifdef HAVE_GEOS_WKT_WRITER_SET_TRIM - PHP_ME(WKTWriter, setTrim, NULL, 0) + PHP_ME(WKTWriter, setTrim, arginfo_void, 0) # endif # ifdef HAVE_GEOS_WKT_WRITER_SET_ROUNDING_PRECISION - PHP_ME(WKTWriter, setRoundingPrecision, NULL, 0) + PHP_ME(WKTWriter, setRoundingPrecision, arginfo_void, 0) # endif # ifdef HAVE_GEOS_WKT_WRITER_SET_OUTPUT_DIMENSION - PHP_ME(WKTWriter, setOutputDimension, NULL, 0) + PHP_ME(WKTWriter, setOutputDimension, arginfo_void, 0) # endif # ifdef HAVE_GEOS_WKT_WRITER_GET_OUTPUT_DIMENSION - PHP_ME(WKTWriter, getOutputDimension, NULL, 0) + PHP_ME(WKTWriter, getOutputDimension, arginfo_void, 0) # endif # ifdef HAVE_GEOS_WKT_WRITER_SET_OLD_3D - PHP_ME(WKTWriter, setOld3D, NULL, 0) + PHP_ME(WKTWriter, setOld3D, arginfo_void, 0) # endif {NULL, NULL, NULL} @@ -2480,7 +2491,7 @@ static zend_class_entry *WKTWriter_ce_ptr; static zend_object_handlers WKTWriter_object_handlers; static void -WKTWriter_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) +WKTWriter_dtor (GEOS_PHP_DTOR_OBJECT *object) { #if PHP_VERSION_ID < 70000 Proxy *obj = (Proxy *)object; @@ -2501,7 +2512,7 @@ WKTWriter_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) } static zend_object_value -WKTWriter_create_obj (zend_class_entry *type TSRMLS_DC) +WKTWriter_create_obj (zend_class_entry *type) { return Gen_create_obj(type, WKTWriter_dtor, &WKTWriter_object_handlers); } @@ -2513,7 +2524,7 @@ PHP_METHOD(WKTWriter, __construct) obj = GEOSWKTWriter_create_r(GEOS_G(handle)); if ( ! obj ) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, "GEOSWKTWriter_create() failed (didn't initGEOS?)"); } @@ -2530,7 +2541,7 @@ PHP_METHOD(WKTWriter, write) writer = (GEOSWKTWriter*)getRelay(getThis(), WKTWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); @@ -2557,7 +2568,7 @@ PHP_METHOD(WKTWriter, setTrim) writer = (GEOSWKTWriter*)getRelay(getThis(), WKTWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &trimval) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &trimval) == FAILURE) { RETURN_NULL(); @@ -2576,7 +2587,7 @@ PHP_METHOD(WKTWriter, setRoundingPrecision) writer = (GEOSWKTWriter*)getRelay(getThis(), WKTWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &prec) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &prec) == FAILURE) { RETURN_NULL(); @@ -2597,7 +2608,7 @@ PHP_METHOD(WKTWriter, setOutputDimension) writer = (GEOSWKTWriter*)getRelay(getThis(), WKTWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &dim) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &dim) == FAILURE) { RETURN_NULL(); @@ -2633,7 +2644,7 @@ PHP_METHOD(WKTWriter, setOld3D) writer = (GEOSWKTWriter*)getRelay(getThis(), WKTWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bval) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bval) == FAILURE) { RETURN_NULL(); @@ -2657,15 +2668,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_void, 0) + PHP_ME(WKBWriter, getOutputDimension, arginfo_void, 0) + PHP_ME(WKBWriter, setOutputDimension, arginfo_void, 0) + PHP_ME(WKBWriter, getByteOrder, arginfo_void, 0) + PHP_ME(WKBWriter, setByteOrder, arginfo_void, 0) + PHP_ME(WKBWriter, getIncludeSRID, arginfo_void, 0) + PHP_ME(WKBWriter, setIncludeSRID, arginfo_void, 0) + PHP_ME(WKBWriter, write, arginfo_void, 0) + PHP_ME(WKBWriter, writeHEX, arginfo_void, 0) {NULL, NULL, NULL} }; @@ -2674,7 +2685,7 @@ static zend_class_entry *WKBWriter_ce_ptr; static zend_object_handlers WKBWriter_object_handlers; static void -WKBWriter_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) +WKBWriter_dtor (GEOS_PHP_DTOR_OBJECT *object) { #if PHP_VERSION_ID < 70000 Proxy *obj = (Proxy *)object; @@ -2695,7 +2706,7 @@ WKBWriter_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) } static zend_object_value -WKBWriter_create_obj (zend_class_entry *type TSRMLS_DC) +WKBWriter_create_obj (zend_class_entry *type) { return Gen_create_obj(type, WKBWriter_dtor, &WKBWriter_object_handlers); } @@ -2710,7 +2721,7 @@ PHP_METHOD(WKBWriter, __construct) obj = GEOSWKBWriter_create_r(GEOS_G(handle)); if ( ! obj ) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, "GEOSWKBWriter_create() failed (didn't initGEOS?)"); } @@ -2742,7 +2753,7 @@ PHP_METHOD(WKBWriter, setOutputDimension) writer = (GEOSWKBWriter*)getRelay(getThis(), WKBWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &dim) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &dim) == FAILURE) { RETURN_NULL(); @@ -2766,7 +2777,7 @@ PHP_METHOD(WKBWriter, write) writer = (GEOSWKBWriter*)getRelay(getThis(), WKBWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); @@ -2798,7 +2809,7 @@ PHP_METHOD(WKBWriter, writeHEX) writer = (GEOSWKBWriter*)getRelay(getThis(), WKBWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); @@ -2841,7 +2852,7 @@ PHP_METHOD(WKBWriter, setByteOrder) writer = (GEOSWKBWriter*)getRelay(getThis(), WKBWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &dim) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &dim) == FAILURE) { RETURN_NULL(); @@ -2879,7 +2890,7 @@ PHP_METHOD(WKBWriter, setIncludeSRID) writer = (GEOSWKBWriter*)getRelay(getThis(), WKBWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &incVal) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &incVal) == FAILURE) { RETURN_NULL(); @@ -2896,9 +2907,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_void, 0) + PHP_ME(WKBReader, read, arginfo_void, 0) + PHP_ME(WKBReader, readHEX, arginfo_void, 0) {NULL, NULL, NULL} }; @@ -2907,7 +2918,7 @@ static zend_class_entry *WKBReader_ce_ptr; static zend_object_handlers WKBReader_object_handlers; static void -WKBReader_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) +WKBReader_dtor (GEOS_PHP_DTOR_OBJECT *object) { #if PHP_VERSION_ID < 70000 Proxy *obj = (Proxy *)object; @@ -2928,7 +2939,7 @@ WKBReader_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) } static zend_object_value -WKBReader_create_obj (zend_class_entry *type TSRMLS_DC) +WKBReader_create_obj (zend_class_entry *type) { return Gen_create_obj(type, WKBReader_dtor, &WKBReader_object_handlers); } @@ -2941,7 +2952,7 @@ PHP_METHOD(WKBReader, __construct) obj = GEOSWKBReader_create_r(GEOS_G(handle)); if ( ! obj ) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, "GEOSWKBReader_create() failed (didn't initGEOS?)"); } @@ -2957,7 +2968,7 @@ PHP_METHOD(WKBReader, read) reader = (GEOSWKBReader*)getRelay(getThis(), WKBReader_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), #if PHP_VERSION_ID >= 70000 "S", &wkb #else @@ -2995,7 +3006,7 @@ PHP_METHOD(WKBReader, readHEX) reader = (GEOSWKBReader*)getRelay(getThis(), WKBReader_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &wkb, &wkblen) == FAILURE) { RETURN_NULL(); @@ -3058,7 +3069,7 @@ PHP_FUNCTION(GEOSPolygonize) zval *array_elem; zval *zobj; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); @@ -3106,7 +3117,7 @@ PHP_FUNCTION(GEOSLineMerge) GEOSGeometry *geom_out; zval *zobj; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); @@ -3133,7 +3144,7 @@ PHP_FUNCTION(GEOSSharedPaths) GEOSGeometry *geom_out; zval *zobj1, *zobj2; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oo", &zobj1, &zobj2) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "oo", &zobj1, &zobj2) == FAILURE) { RETURN_NULL(); @@ -3171,7 +3182,7 @@ PHP_METHOD(Geometry, delaunayTriangulation) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|db", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|db", &tolerance, &edgeonly) == FAILURE) { RETURN_NULL(); } @@ -3211,7 +3222,7 @@ PHP_METHOD(Geometry, voronoiDiagram) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|dbo", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|dbo", &tolerance, &edgeonly, &zobj) == FAILURE) { RETURN_NULL(); } @@ -3244,7 +3255,7 @@ PHP_FUNCTION(GEOSRelateMatch) int ret; zend_bool retBool; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &mat, &matlen, &pat, &patlen) == FAILURE) { RETURN_NULL(); @@ -3268,7 +3279,7 @@ PHP_MINIT_FUNCTION(geos) /* WKTReader */ INIT_CLASS_ENTRY(ce, "GEOSWKTReader", WKTReader_methods); - WKTReader_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC); + WKTReader_ce_ptr = zend_register_internal_class(&ce); WKTReader_ce_ptr->create_object = WKTReader_create_obj; memcpy(&WKTReader_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -3280,7 +3291,7 @@ PHP_MINIT_FUNCTION(geos) /* WKTWriter */ INIT_CLASS_ENTRY(ce, "GEOSWKTWriter", WKTWriter_methods); - WKTWriter_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC); + WKTWriter_ce_ptr = zend_register_internal_class(&ce); WKTWriter_ce_ptr->create_object = WKTWriter_create_obj; memcpy(&WKTWriter_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -3292,7 +3303,7 @@ PHP_MINIT_FUNCTION(geos) /* Geometry */ INIT_CLASS_ENTRY(ce, "GEOSGeometry", Geometry_methods); - Geometry_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC); + Geometry_ce_ptr = zend_register_internal_class(&ce); Geometry_ce_ptr->create_object = Geometry_create_obj; memcpy(&Geometry_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -3307,7 +3318,7 @@ PHP_MINIT_FUNCTION(geos) /* WKBWriter */ INIT_CLASS_ENTRY(ce, "GEOSWKBWriter", WKBWriter_methods); - WKBWriter_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC); + WKBWriter_ce_ptr = zend_register_internal_class(&ce); WKBWriter_ce_ptr->create_object = WKBWriter_create_obj; memcpy(&WKBWriter_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -3319,7 +3330,7 @@ PHP_MINIT_FUNCTION(geos) /* WKBReader */ INIT_CLASS_ENTRY(ce, "GEOSWKBReader", WKBReader_methods); - WKBReader_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC); + WKBReader_ce_ptr = zend_register_internal_class(&ce); WKBReader_ce_ptr->create_object = WKBReader_create_obj; memcpy(&WKBReader_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/php_geos.h b/php_geos.h index 5350541..9a63492 100644 --- a/php_geos.h +++ b/php_geos.h @@ -26,7 +26,7 @@ #define PHP_GEOS_H /* TODO: generate from ./configure ? */ -#define PHP_GEOS_VERSION "0.0" +#define PHP_GEOS_VERSION "1.0.1" #define PHP_GEOS_EXTNAME "geos" #ifdef HAVE_CONFIG_H diff --git a/tests/004_WKBWriter.phpt b/tests/004_WKBWriter.phpt index d2b3c85..3a72e2d 100644 --- a/tests/004_WKBWriter.phpt +++ b/tests/004_WKBWriter.phpt @@ -139,7 +139,7 @@ class WKBWriterTest extends GEOSTest $writer->write(1); $this->assertTrue(false); } catch (ErrorException $e) { - $this->assertContains('expects parameter 1 to be object, integer given', $e->getMessage()); + $this->assertContains('expects parameter 1 to be object, int', $e->getMessage()); } } @@ -151,7 +151,7 @@ class WKBWriterTest extends GEOSTest $writer->writeHEX(1); $this->assertTrue(false); } catch (ErrorException $e) { - $this->assertContains('expects parameter 1 to be object, integer given', $e->getMessage()); + $this->assertContains('expects parameter 1 to be object, int', $e->getMessage()); } } }