Advertisement
Guest User

PHP SSL ini_set 'default_socket_timeout' bug

a guest
Jan 30th, 2014
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. <?PHP
  2. #filename index.php PHP 5.3.3
  3. #https://bugs.php.net/bug.php?id=41631
  4. //SERVER CODE
  5.  
  6. // server
  7. class MySoapServer{
  8.  
  9. public function getMessage(){
  10. return 'Hello,World!';
  11. }
  12.  
  13. public function addNumbers($num1,$num2){
  14. sleep(200);
  15. return $num1+$num2;
  16. }
  17.  
  18. }
  19.  
  20. $options= array('uri'=>'https://localhost/test');
  21. $server=new SoapServer(NULL,$options);
  22. $server->setClass('MySoapServer');
  23. $server->handle();
  24. ?>
  25.  
  26.  
  27. <?PHP
  28. #PHP 5.3.3 (cli) (built: Dec 11 2013 03:29:57)
  29. #Copyright (c) 1997-2010 The PHP Group
  30. #Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
  31. #with Xdebug v2.1.4, Copyright (c) 2002-2012, by Derick Rethans
  32.  
  33. // client
  34. $options= array(
  35. 'uri' => 'https://localhsot/',
  36. 'location' => 'https://localhost/',
  37. 'connection_timeout' => 30,
  38. );
  39. ini_set('default_socket_timeout',20);
  40. file_put_contents('/tmp/ini.txt',print_r(ini_get_all(),true)."\n",FILE_APPEND);
  41. $start = time();
  42. $client = new SoapClient(NULL,$options);
  43. echo $client->getMessage()."\n"; //Hello,World!
  44. $end = time();
  45. echo "runtime : " .($end - $start). "\n";
  46. echo $client->addNumbers(3,5)."\n"; // 8
  47. $end = time();
  48. echo "runtime : " .($end - $start) ."\n";
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement