Req #66455 [NEW]: Missing function to determine refcount of variables directy

From: Date: Fri, 10 Jan 2014 08:43:33 +0000
Subject: Req #66455 [NEW]: Missing function to determine refcount of variables directy
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183688@lists.php.net to get a copy of this message
From:             leuffen at continue dot de
Operating system: Linux
PHP version:      5.5.8RC1
Package:          Variables related
Bug Type:         Feature/Change Request
Bug description:Missing function to determine refcount of variables directy

Description:
------------
While working on an Entity-Manager Class I noticed PHP has no function
to determine the number of active references to a variable/object (like
debug_zval_dump() does).

It would be great if PHP provided that feature in later versions.






Test script:
---------------
/**
 * function to do the job:
 *
 */
function refcount ($var) {
    ob_start();
    debug_zval_dump($var);
    $zval = ob_get_clean();

    preg_match ("/refcount\\(([0-9]+)\\)/", $zval, $matches);
    return $matches[1];
}



-- 
Edit bug report at https://bugs.php.net/bug.php?id=66455&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=66455&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=66455&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=66455&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=66455&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=66455&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=66455&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=66455&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=66455&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=66455&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=66455&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=66455&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=66455&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=66455&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66455&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=66455&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=66455&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=66455&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66455&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=66455&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=66455&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#183688) next »