WordPress.org

Make WordPress Core

Ticket #18044: wp-3.2-off-by-1-demo.php

File wp-3.2-off-by-1-demo.php, 668 bytes (added by meitar, 4 years ago)

Crude plugin that shows off-by-1 error in delete_post hook.

Line 
1<?php
2/**
3Plugin Name: Demonstration of off by 1 error in WordPress 3.2.
4Plugin URI:
5Description: This plugin demonstrates a possible regression in WordPress 3.2 where the 'delete_post' hook is passed the wrong value for its $postid parameter.
6Author: Meitar Moscovitz
7Author URI: http://maymay.net/
8*/
9
10function 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
22add_action( 'delete_post', 'notePostID' );
23?>