Skip to content
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

PHP7 support #27

Merged
merged 5 commits into from
Aug 4, 2015
Merged

PHP7 support #27

merged 5 commits into from
Aug 4, 2015

Conversation

jbboehr
Copy link
Contributor

@jbboehr jbboehr commented Jul 30, 2015

Some notes:

  • Changed version from nightly to '7.0' This is currently an alias for nightly and will presumably be replaced with the actual release once it's done.
  • In PHP7, hex strings are no longer implicitly converted when compared to integers, so I'm marking the tests as incomplete if GMP is not available.
  • I changed the TravisCI configuration to use their new container infrastructure, which is supposed to be faster. I can revert if you want.

@oschwald
Copy link
Member

Thanks for doing this, including the Travis changes! The diff is pretty big so it might take us a little while to review this. Do you know of any good documentation on the changes to Zend Engine that accompany PHP 7? I briefly looked and did not find anything great. From your changes, they appear to be reasonably significant.

@jbboehr
Copy link
Contributor Author

jbboehr commented Jul 30, 2015

@oschwald
Copy link
Member

Great. Thanks!

FREE_HASHTABLE(obj->std.properties);
}

//efree(obj);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this no longer necessary? If it is really not necessary, could we remove it rather than commenting it out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

static zend_class_entry *lookup_class(const char *name TSRMLS_DC)
{
#ifdef ZEND_ENGINE_3
zend_string *n = zend_string_init(name, strlen(name), 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am getting leaks here when running the test suite with Valgrind on PHP 7:

==24951==    by 0xFD0554E: zend_string_alloc (zend_string.h:121)
==24951==    by 0xFD0554E: zend_string_init (zend_string.h:157)
==24951==    by 0xFD0554E: lookup_class (maxminddb.c:458)
==24951==    by 0xFD05FFB: zim_MaxMind_Db_Reader_close (maxminddb.c:291)
==24951==    by 0x85B621: ZEND_DO_FCALL_SPEC_HANDLER (zend_vm_execute.h:836)
==24951==    by 0x80705A: execute_ex (zend_vm_execute.h:406)
==24951==    by 0x7B61C9: zend_call_function (zend_execute_API.c:852)
==24951==    by 0x68DDC5: zim_reflection_method_invokeArgs (php_reflection.c:3365)
==24951==    by 0x85B621: ZEND_DO_FCALL_SPEC_HANDLER (zend_vm_execute.h:836)
==24951==    by 0x80705A: execute_ex (zend_vm_execute.h:406)
==24951==    by 0x85EE86: zend_execute (zend_vm_execute.h:450)
==24951==    by 0x7C58C4: zend_execute_scripts (zend.c:1404)
==24951==    by 0x7652CF: php_execute_script (main.c:2475)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, I can't get anything to produce that or the above message even though it should obviously leak. I've been running:
TEST_PHP_ARGS=-m make test and USE_ZEND_ALLOC=0 valgrind --leak-check=full ~/build/php7/bin/php -n -dextension=ext/modules/maxminddb.so -dreport_memleaks=On ./vendor/bin/phpunit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to set ZEND_DONT_UNLOAD_MODULES=1 as otherwise the module is unloaded and the relevant frames are not included in the trace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oschwald yep, that did it, thanks!

@oschwald
Copy link
Member

oschwald commented Aug 4, 2015

Thanks! With the latest commit, this looks great. 👍

oschwald added a commit that referenced this pull request Aug 4, 2015
@oschwald oschwald merged commit 400f5ce into maxmind:master Aug 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants