Advertisement
Mausglov

Win httpd crushed: child process exited with status 32212257

Nov 7th, 2011
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.41 KB | None | 0 0
  1. <?php
  2.  
  3. class Crusher
  4. {
  5.     protected static $conf = array();
  6.    
  7.     public function __construct ($requested_url = NULL, $query_string = NULL, $auth = NULL)
  8.     {
  9.         self::$conf = array(
  10.             'globals' => array(
  11.                 'charset' => 'windows-1251',
  12.             ),
  13.         );
  14.     }
  15.    
  16.     protected function ConvertRequestDataEncoding()
  17.     {
  18.        
  19.         if(isset(self::$conf,self::$conf['globals'],self::$conf['globals']['charset']))
  20.         {
  21.             array_walk_recursive($_POST,array("self","callbackConvertEncoding"),self::$conf['globals']['charset']);
  22.             array_walk_recursive($_GET,array("self","callbackConvertEncoding"),self::$conf['globals']['charset']);
  23.             array_walk_recursive($_COOKIE,array("self","callbackConvertEncoding"),self::$conf['globals']['charset']);
  24.         }
  25.        
  26.         $_REQUEST = array_merge($_POST,$_GET);
  27.         $_REQUEST = array_merge($_REQUEST,$_COOKIE);
  28.        
  29.     }
  30.    
  31.     protected static function callbackConvertEncoding(&$item,&$key,$from_encoding)
  32.     {      
  33.             $key = mb_convert_encoding($key,"UTF-8",$from_encoding);
  34.             $item = mb_convert_encoding($item,"UTF-8",$from_encoding);
  35.            
  36.             if(!self::is_utf8($item))
  37.             {
  38.                 $item = NULL;
  39.             }
  40.            
  41.             if(!self::is_utf8($key))
  42.             {
  43.                 $key= NULL;
  44.             }
  45.         return;
  46.     }
  47.    
  48.     protected static function is_utf8($string) {
  49.    
  50.         // From http://w3.org/International/questions/qa-forms-utf-8.html
  51.  
  52.         return preg_match('%^(?:
  53.             [\x09\x0A\x0D\x20-\x7E]            # ASCII
  54.             | [\xC2-\xDF][\x80-\xBF]            # non-overlong 2-byte
  55.             |  \xE0[\xA0-\xBF][\x80-\xBF]        # excluding overlongs
  56.             | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}  # straight 3-byte
  57.             |  \xED[\x80-\x9F][\x80-\xBF]        # excluding surrogates
  58.             |  \xF0[\x90-\xBF][\x80-\xBF]{2}    # planes 1-3
  59.             | [\xF1-\xF3][\x80-\xBF]{3}          # planes 4-15
  60.             |  \xF4[\x80-\x8F][\x80-\xBF]{2}    # plane 16
  61.         )*$%xs', $string);
  62.  
  63.     } // function is_utf8
  64.    
  65.    
  66.    
  67.     public function go()
  68.     {
  69.         if ( !empty($_POST) )
  70.         {
  71.             self::ConvertRequestDataEncoding();
  72.         }
  73.     }
  74.    
  75. }
  76. header('Content-Type: text/html; charset=windows-1251');
  77.  
  78. $crushme = new Crusher();
  79. $crushme->go();
  80. ?><!DOCTYPE html>
  81. <html>
  82. <head>
  83. <meta charset="windows-1251">
  84. <title>Crusher</title>
  85. </head>
  86. <body>
  87. <?php
  88. echo '<pre>', print_r($_REQUEST , 1), '</pre>';
  89. ?>
  90. <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
  91. <input name="form[content]" value="Я твой дом труба шатал" /><br/>
  92. <textarea rows="10" cols="40" name="form[ta]">Суспензия, как того требуют законы термодинамики, принципиально неизмерима.
  93. Возмущение плотности приводит к появлению упруго-пластичный тензиометр, хотя этот факт нуждается в дальнейшей тщательной экспериментальной проверке.
  94. Можно думать, что шурф полидисперсен. Конечно, нельзя не принять во внимание тот факт, что ил относительно отражает ташет
  95. в полном соответствии с законом Дарси</textarea><br/>
  96. <input type="submit" />
  97. </form>
  98. </body>
  99. </html>
  100.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement