Skip to content

Commit

Permalink
Merge pull request #53 from TownNews/bugfix/serialization-crash
Browse files Browse the repository at this point in the history
Fix crash when serialization fails
  • Loading branch information
tomassrnka committed Jun 17, 2019
2 parents 2031882 + 8703c36 commit 459ad85
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions php7/memcache_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,11 @@ int mmc_pack_value(mmc_pool_t *pool, mmc_buffer_t *buffer, zval *value, unsigned
php_var_serialize(&buf, value_copy_ptr, &value_hash);
PHP_VAR_SERIALIZE_DESTROY(value_hash);

if (!buf.s) {
php_error_docref(NULL, E_WARNING, "Failed to serialize value");
return MMC_REQUEST_FAILURE;
}

smart_string_appendl(&(buffer->value), ZSTR_VAL(buf.s), ZSTR_LEN(buf.s));
smart_str_free(&buf);

Expand Down

0 comments on commit 459ad85

Please sign in to comment.