diff --git a/README.md b/README.md index 240249e..c8c2634 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# PHP bindings for libspf2 (http://libspf2.org) +# PHP bindings for libspf2 (http://www.libspf2.org) ## Install Make sure you install libspf2 development package first. - $ git clone https://github.com/w3p/php-spf + $ git clone http://github.com/clone_url/php-spf.git $ cd php-spf $ phpize $ ./configure @@ -31,3 +31,13 @@ Make sure you install libspf2 development package first. boolean SpfResponse::hasWarnings(); array SpfResponse::getErrors(); array SpfResponse::getWarnings(); + +### Example + +```php +query("216.239.32.2", "gmail.com", "pgpadron@gmail.com"); +var_dump($response->getResult()); +?> +``` diff --git a/spf.c b/spf.c index dcb4786..97d2b58 100644 --- a/spf.c +++ b/spf.c @@ -29,6 +29,7 @@ #include "spf2/spf.h" #include "spf2/spf_dns_zone.h" #include "spf2/spf_lib_version.h" +#include "netdb.h" zend_class_entry *spf_ce_Spf; zend_class_entry *spf_ce_SpfResponse; @@ -268,11 +269,19 @@ zend_object_value create_spf_response(zend_class_entry *class_type TSRMLS_DC) memset(intern, 0, sizeof(php_spf_response_object)); zend_object_std_init(&intern->std, class_type TSRMLS_CC); + + +#if PHP_VERSION_ID < 50399 zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval*)); + +#else + object_properties_init((zend_object*) &(intern->std), class_type); +#endif + retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, free_spf_response, NULL TSRMLS_CC); retval.handlers = zend_get_std_object_handlers(); @@ -304,11 +313,18 @@ zend_object_value create_spf(zend_class_entry *class_type TSRMLS_DC) memset(intern, 0, sizeof(php_spf_object)); zend_object_std_init(&intern->std, class_type TSRMLS_CC); + + +#if PHP_VERSION_ID < 50399 zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval*)); +#else + object_properties_init((zend_object*) &(intern->std), class_type); +#endif + retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, free_spf, NULL TSRMLS_CC); retval.handlers = zend_get_std_object_handlers();