Zend Framework

throw exceptions within foreach is now available

Details

  • Type: Patch Patch
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Zend_Loader
  • Labels:
    None

Description

Zend.php, Zend::register(), line 293-310
$e = '';
// an object can only be stored in the registry once
foreach (self::$_registry as $dup=>$registeredObject) {
    if ($obj === $registeredObject) {
        $e = "Duplicate object handle already exists in the registry as \"$dup\".";
        break;
    }
}

/**
 * @todo throwing exceptions inside foreach could cause leaks, use a workaround
 *       like this until a fix is available
 *
 * @link http://bugs.php.net/bug.php?id=34065
 */
if ($e) {
    throw new Zend_Exception($e);
}

now it can be

// an object can only be stored in the registry once
foreach (self::$_registry as $dup=>$registeredObject) {
    if ($obj === $registeredObject) {
        throw new Zend_Exception("Duplicate object handle already exists in the registry as \"$dup\".");
    }
}

But if ZF's minimal requirements will be PHP 5.2.0 (foreach memleak fixed in it).

Activity

Hide
Bill Karwin added a comment -

Assigning to Gavin.

Show
Bill Karwin added a comment - Assigning to Gavin.
Hide
Gavin added a comment -

Fixed in changeset 2387.

Show
Gavin added a comment - Fixed in changeset 2387.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: