Bug #75622 [Opn]: ZEND API zend_parse_parameters is called, refcount value is different
| From: | fanjiapeng at 360 dot cn | Date: | Tue, 05 Dec 2017 03:20:11 +0000 |
| Subject: | Bug #75622 [Opn]: ZEND API zend_parse_parameters is called, refcount value is different | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-212923@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75622&edit=1
ID: 75622
User updated by: fanjiapeng at 360 dot cn
Reported by: fanjiapeng at 360 dot cn
Summary: ZEND API zend_parse_parameters is called, refcount
value is different
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: CentOS release 6.2 (Final)
PHP Version: 7.1Git-2017-12-04 (Git)
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2017-12-04 14:27:24] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75622&edit=1