Home » PEAR » PEAR » Bug #6445
PEAR::registerShutdownFunc doesn't work in static calls
Details
| Submitted | 2006-01-08 21:14 UTC |
|---|---|
| From | soporte at onfocus dot cl |
| Assigned | cellog |
| Status | Closed |
| Package | PEAR |
| PHP Version | Irrelevant |
| OS | Irrelevant |
| 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.