From 0b5a77adc1d572f54eff13f184027a62d9e62eaf Mon Sep 17 00:00:00 2001 From: Mathieu CARBONNEAUX Date: Sun, 28 Jun 2015 19:57:22 +0200 Subject: [PATCH 1/5] php 5.4 correction --- spf.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spf.c b/spf.c index dcb4786..fc5c96b 100644 --- a/spf.c +++ b/spf.c @@ -28,6 +28,7 @@ #include "netinet/in.h" #include "spf2/spf.h" #include "spf2/spf_dns_zone.h" +#include "spf2/spf_dns.h" #include "spf2/spf_lib_version.h" zend_class_entry *spf_ce_Spf; @@ -268,11 +269,15 @@ 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.properties), 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 +309,15 @@ 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.properties), 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(); @@ -346,7 +355,7 @@ PHP_METHOD(Spf, __construct) obj->spf_server = SPF_server_new(server_type, 0); if (server_type == SPF_DNS_ZONE) { - if (SPF_dns_zone_add_str(obj->spf_server->resolver, domain, ns_t_txt, NETDB_SUCCESS, spf)) { + if (SPF_dns_zone_add_str(obj->spf_server->resolver, domain, ns_t_txt, 0, spf)) { zend_throw_exception(spf_ce_SpfException, "Invalid SPF record", 0 TSRMLS_CC); } } From 875771bc1f4c1eaa16faf6f0afeb20abd951337c Mon Sep 17 00:00:00 2001 From: Mathieu CARBONNEAUX Date: Sun, 24 Apr 2016 21:56:51 +0200 Subject: [PATCH 2/5] =?UTF-8?q?fix=20compilation=20error=20=E2=80=98zend?= =?UTF-8?q?=5Fclass=5Fentry=E2=80=99=20has=20no=20member=20named=20?= =?UTF-8?q?=E2=80=98default=5Fproperties=E2=80=99=20fix=20compilation=20er?= =?UTF-8?q?ror=20=E2=80=98NETDB=5FSUCCESS=E2=80=99=20undeclared=20(first?= =?UTF-8?q?=20use=20in=20this=20function)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spf.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/spf.c b/spf.c index fc5c96b..97d2b58 100644 --- a/spf.c +++ b/spf.c @@ -28,8 +28,8 @@ #include "netinet/in.h" #include "spf2/spf.h" #include "spf2/spf_dns_zone.h" -#include "spf2/spf_dns.h" #include "spf2/spf_lib_version.h" +#include "netdb.h" zend_class_entry *spf_ce_Spf; zend_class_entry *spf_ce_SpfResponse; @@ -269,15 +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.properties), class_type); + 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(); @@ -309,6 +313,8 @@ 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, @@ -316,9 +322,10 @@ zend_object_value create_spf(zend_class_entry *class_type TSRMLS_DC) (void *) &tmp, sizeof(zval*)); #else - object_properties_init((zend_object*) &(intern->std.properties), class_type); + 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(); @@ -355,7 +362,7 @@ PHP_METHOD(Spf, __construct) obj->spf_server = SPF_server_new(server_type, 0); if (server_type == SPF_DNS_ZONE) { - if (SPF_dns_zone_add_str(obj->spf_server->resolver, domain, ns_t_txt, 0, spf)) { + if (SPF_dns_zone_add_str(obj->spf_server->resolver, domain, ns_t_txt, NETDB_SUCCESS, spf)) { zend_throw_exception(spf_ce_SpfException, "Invalid SPF record", 0 TSRMLS_CC); } } From f5f7f0f6159adb884defe01d22727138bbcd71a4 Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Sun, 24 Apr 2016 22:01:54 +0200 Subject: [PATCH 3/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 240249e..252fa23 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# PHP bindings for libspf2 (http://libspf2.org) +# PHP bindings for libspf2 (http://www.libspf2.org) ## Install From 0363552e8e25503db25fdfb59c91e4235ce92b7a Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Sun, 24 Apr 2016 22:13:35 +0200 Subject: [PATCH 4/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 252fa23..bde340e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ 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 From 4e9e3c162c3e962bcd16fa2589190c617209e7f8 Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Sun, 24 Apr 2016 22:43:52 +0200 Subject: [PATCH 5/5] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index bde340e..c8c2634 100644 --- a/README.md +++ b/README.md @@ -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()); +?> +```