| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | Plugin Name: PHP Floating Point DoS Attack Workaround |
|---|
| 4 | Version: 0.1 |
|---|
| 5 | Plugin URI: http://core.trac.wordpress.org/ticket/16097 |
|---|
| 6 | Description: Prevents 32-bit PHP version from hanging when processing a request with 2.2250738585072011e-308 value. |
|---|
| 7 | Author: AirCraft24.com, Sergey Biryukov |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | if ( $_REQUEST ) { |
|---|
| 11 | while ( list( $key, $value ) = each( $_REQUEST ) ) { |
|---|
| 12 | $value = str_replace( '.', '', $value ); |
|---|
| 13 | if ( preg_match( '/22250738585072011[0]*e/i', $value ) ) { |
|---|
| 14 | unset( $_REQUEST[$key] ); |
|---|
| 15 | unset( $_GET[$key] ); |
|---|
| 16 | unset( $_POST[$key] ); |
|---|
| 17 | unset( $_COOKIE[$key] ); |
|---|
| 18 | $GLOBALS[$key] = ''; |
|---|
| 19 | } |
|---|
| 20 | } |
|---|
| 21 | reset( $_REQUEST ); |
|---|
| 22 | } |
|---|
| 23 | ?> |
|---|