Skip to content

Instantly share code, notes, and snippets.

@Ultimater
Created June 15, 2018 07:01
Show Gist options
  • Save Ultimater/4525404c2b48f6d7458b1ca2607d2fb8 to your computer and use it in GitHub Desktop.
Save Ultimater/4525404c2b48f6d7458b1ca2607d2fb8 to your computer and use it in GitHub Desktop.
Phalcon bug. Run as http://localhost/bug.php
<?php
if( isset($_GET) && isset($_GET['test']) && $_GET['test'] === 'phalcon')
{
$di = new \Phalcon\Di\FactoryDefault();
usleep( 100000 );
exit;
}
$ch1 = curl_init();
$ch2 = curl_init();
curl_setopt($ch1, CURLOPT_URL, 'http://localhost/bug.php?test=phalcon');
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch2, CURLOPT_URL, 'http://localhost/bug.php?test=phalcon');
curl_setopt($ch2, CURLOPT_HEADER, 0);
//create the multiple cURL handle
$mh = curl_multi_init();
//add the two handles
curl_multi_add_handle($mh,$ch1);
curl_multi_add_handle($mh,$ch2);
$active = null;
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
while ($active && $mrc == CURLM_OK)
{
if (curl_multi_select($mh) == -1) {
usleep(1000);
}
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);
@Ultimater
Copy link
Author

Link back to the cphalcon issue: phalcon/cphalcon#12056

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment