1 | <?php |
---|
2 | /** |
---|
3 | Plugin Name: Demonstration of off by 1 error in WordPress 3.2. |
---|
4 | Plugin URI: |
---|
5 | Description: This plugin demonstrates a possible regression in WordPress 3.2 where the 'delete_post' hook is passed the wrong value for its $postid parameter. |
---|
6 | Author: Meitar Moscovitz |
---|
7 | Author URI: http://maymay.net/ |
---|
8 | */ |
---|
9 | |
---|
10 | function notePostID ($postid) { |
---|
11 | ob_start(); |
---|
12 | echo 'The $postid passed in is: '; |
---|
13 | var_dump($postid); |
---|
14 | echo '. However, the value of $_GET[\'post\'] was: '; |
---|
15 | var_dump($_GET['post']); |
---|
16 | $out = ob_get_contents(); |
---|
17 | ob_end_clean(); |
---|
18 | var_dump(htmlentities($out, ENT_QUOTES, 'UTF-8')); |
---|
19 | exit(); |
---|
20 | } |
---|
21 | |
---|
22 | add_action( 'delete_post', 'notePostID' ); |
---|
23 | ?> |
---|