php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75622 ZEND API zend_parse_parameters is called, refcount value is different
Submitted: 2017-12-04 14:27 UTC Modified: 2017-12-05 03:56 UTC
From: fanjiapeng at 360 dot cn Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 7.1Git-2017-12-04 (Git) OS: CentOS release 6.2 (Final)
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: fanjiapeng at 360 dot cn
New email:
PHP Version: OS:

 

 [2017-12-04 14:27 UTC] fanjiapeng at 360 dot cn
Description:
------------
In The PHP 7.1.5 (cli)( NTS DEBUG ).
My create a 'test' class with PHP extension, It's have a method __construct. Short code:

PHP_METHOD(test, __construct)
{
    zval *configs = NULL;
    if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &configs) == FAILURE) {
        return;
    }
    php_printf("refcount = %d \n", Z_REFCOUNTED_P(configs));
}

The 'refcount' result of the first execution is 1, The 'refcount' result of the second execution is 0. Both CLI mode and FPM mode all exist. The PHP version 7.0.19 ( NTS ) this BUG does not exist.


Test script:
---------------
<?php
$configs = array(
    'dsn' => array('host' => '127.0.0.1', 'dbname' => 'test', 'port' => 3306),
);

$a = &$configs;
$b = $a;

$mysql = new test($a);

Expected result:
----------------
refcount = 0

Actual result:
--------------
refcount = 1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-12-05 03:20 UTC] fanjiapeng at 360 dot cn
update context on yesterday. The correct result is as follows:

Expected result(PHP 7.0.19 NTS, 7.2.0 NTS):
----------------
refcount = 1

Actual result(PHP 7.1.5 NTS):
--------------
refcount = 0

The PHP version 7.0.19 ( NTS ) and PHP 7.2.0 (cli)( NTS DEBUG ) this BUG does not exist.
 [2017-12-05 03:56 UTC] laruence@php.net
-Status: Open +Status: Not a bug
 [2017-12-05 03:56 UTC] laruence@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

I think you was meaning Z_REFCOUNT_P, Z_REFCOUNTED_P result bool value, indicate whether the value is Z_TYPE_REFCOUNTED.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 08:01:28 2024 UTC