|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74073 zend_string_free: Assertion `(s)->gc.refcount <= 1' failed
Submitted: 2017-02-10 11:02 UTC Modified: 2021-02-15 13:27 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: rmoisto at gmail dot com Assigned: cmb (profile)
Status: Closed Package: mongodb (PECL)
PHP Version: 7.1.1 OS: Ubuntu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: rmoisto at gmail dot com
New email:
PHP Version: OS:


 [2017-02-10 11:02 UTC] rmoisto at gmail dot com
A project I'm working on, recently started using MongoDB for some of it's storage. I can't share the entire project, the following is the smallest code example that reproduces the crash.

This is not an issue with the official Ubuntu PHP 7.0 packages. I have compiled PHP 7.1.1 and MongoDB extension myself.

I tried getting a core dump but couldn't figure it out. I have a debug build so it should be possible but I can't get it set up.

Steps to reproduce:
1. Use PHP 7.1.1
2. Install mongodb extension
3. Create composer.json with the following contents:
	"require" : {

4. Run `composer install`
5. Save test script as test.php
6. Run `php test.php`

Test script:

require 'vendor/autoload.php';

$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");

$bulk = new MongoDB\Driver\BulkWrite;
$id = $bulk->insert(['x' => 1]);
$manager->executeBulkWrite('db.collection', $bulk);

$query = new MongoDB\Driver\Query(['_id' => $id]);
$cursor = $manager->executeQuery('db.collection', $query);
	'array' => 'MongoDB\\Model\\BSONArray',
	'document' => 'MongoDB\\Model\\BSONDocument',
	'root' => 'MongoDB\\Model\\BSONDocument'

Expected result:
Unhandled exception

Actual result:
php: /home/rauno/php7/include/php/Zend/zend_string.h:263: zend_string_free: Assertion `(s)->gc.refcount <= 1' failed.
Aborted (core dumped)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-04 07:05 UTC] dominik at labudzinski dot com
Have same problem but not with mongodb.
This line generate error:

$raw = \Sodium\crypto_aead_aes256gcm_encrypt($raw,$aad,$nonce,$key);
 [2017-10-04 08:10 UTC] rmoisto at gmail dot com
This issue has been resolved for MongoDB here:
 [2021-02-15 13:27 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-02-15 13:27 UTC]
> This issue has been resolved for MongoDB here:

Well, than this ticket can be closed.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 21:01:30 2024 UTC