PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » PEAR » PEAR » Bug #6445

PEAR::registerShutdownFunc doesn't work in static calls

Details

Submitted2006-01-08 21:14 UTC
Fromsoporte at onfocus dot cl
Assignedcellog
StatusClosed
PackagePEAR
PHP VersionIrrelevant
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2006-01-08 21:14 UTC] soporte at onfocus dot cl

Description:
------------
System::mktemp calls PEAR::registerShutdownFunc but that method fails if used statically. This is not specific to System package, but all who use PEAR::registerShutdownFunc .

Test script:
---------------
<?php
require_once 'System.php';
$path = System::mktemp('deleteme');
?>

=====================
patch in PEAR.php#248
=====================

function registerShutdownFunc($func, $args = array())
{
if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
register_shutdown_function("_PEAR_call_destructors");
$GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
}
$GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args);
}

Expected result:
----------------
file deleted after script execution.

Actual result:
--------------
file never deleted.