-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[BUG] [CRASH] Spurious crashes in CollectionsTest.php #851
Comments
Looks like this is a bug in the Mongo PHP extension: PHP_METHOD(MongoCollection, save)
{
zval *a, *options = 0;
zval **id;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|a/", &a, &options) == FAILURE) {
return;
}
MUST_BE_ARRAY_OR_OBJECT(1, a);
if (!options) {
MAKE_STD_ZVAL(options);
array_init(options);
}
if (zend_hash_find(HASH_P(a), "_id", 4, (void**)&id) == SUCCESS) {
/* ... */
MONGO_METHOD3(MongoCollection, update, return_value, getThis(), criteria, a, options);
zval_ptr_dtor(&criteria);
zval_ptr_dtor(&options);
return;
}
/* ... */
} That is, they separate
|
The suggested workaround is to use the slow call path for PHP 5.3, like this: #if PHP_VERSION_ID < 50400
{
zval *params[2] = { data, options };
zval func;
INIT_ZVAL(func);
ZVAL_STRING(&func, "save", 0);
call_user_function(EG(function_table), &collection, &func, status, 2, params TSRMLS_CC);
}
#else
phalcon_call_method_p2(status, collection, "save", data, options);
#endif This does not solve the issue with invalid memory reads BUT eliminates invalid writes and PHP does not crash anymore. |
|
Fixed by @sjinks |
This happens mostly for PHP 5.3 and happens both for 1.1.0 and 1.2.0:
When run under valgrind:
USE_ZEND_ALLOC=0 valgrind $(phpenv which php) unit-tests/manual-unit.php CollectionsTest.php CollectionsTest
The following output is given:
The text was updated successfully, but these errors were encountered: