Page MenuHomePhabricator
Paste P14574

memcached-excimer.php
ActivePublic

Authored by tstarling on Mar 3 2021, 2:56 AM.
Tags
None
Referenced Files
F34132900: memcached-excimer.php
Mar 3 2021, 2:58 AM
F34132898: memcached-excimer.php
Mar 3 2021, 2:56 AM
Subscribers
None
<?php
header( 'Content-Type: text/plain; charset=utf-8' );
set_error_handler( 'handle_error' );
$t = microtime( true );
while ( microtime( true ) - $t < 10 ) {
$timer = new ExcimerTimer;
$timer->setPeriod( 0.001 );
$timer->setCallback( function () {
throw new RuntimeException;
} );
$timer->start();
while ( microtime( true ) - $t < 10 ) {
try {
while ( microtime( true ) - $t < 10 ) {
try {
$memcached = new Memcached;
} catch ( RuntimeException $e ) {
}
if ( !$memcached ) {
continue;
}
try {
$memcached->addServer( 'localhost', 11211 );
} catch ( RuntimeException $e ) {
}
try {
$memcached->get( 'test' );
} catch ( RuntimeException $e ) {
}
try {
$memcached = null;
} catch ( RuntimeException $e ) {
echo "Caught exception from destructor\n";
var_dump( $memcached );
$memcached->get( 'test' );
}
}
} catch ( RuntimeException $e ) {
}
}
}
echo "Done\n";
function handle_error( $errno, $errstr, $errfile, $errline, $errcontext ) {
echo "Got error: $errstr\n";
print ( new Exception )->getTraceAsString();
exit;
}