This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

PHP SSL ini_set 'default_socket_timeout' bug

By: a guest on Jan 30th, 2014  |  syntax: None  |  size: 1.25 KB  |  views: 60  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. ?>
clone this paste RAW Paste Data