Skip to content

Fix PHP 5.4 Compile error #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -31,3 +31,13 @@ Make sure you install libspf2 development package first.
boolean SpfResponse::hasWarnings();
array SpfResponse::getErrors();
array SpfResponse::getWarnings();

### Example

```php
<?php
$spf = new Spf();
$response = $spf->query("216.239.32.2", "gmail.com", "pgpadron@gmail.com");
var_dump($response->getResult());
?>
```
16 changes: 16 additions & 0 deletions spf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();
Expand Down