wp_getPages fails if WP_DEBUG is set, and no page count parameter provided
|Reported by:||redsweater||Owned by:||westi|
Apparently there is a difference in the way php4 and php5 behave when it comes to missing XMLRPC parameters. In php4, the existing behavior of wp_getPages works well, causing a default page count of 10 to be used if the:
$num_pages = (int) $args;
line evaluates to a $num_pages that fails the test "isset()".
In PHP 5, if the client provides no 4th argument ($args), then the evaluation fails abruptly with a console-written error about 3 being a bad index.
To fix this, I am providing a patch that is more deliberately defensive against a missing 4th parameter. If the 4th parameter doesn't exist, the default value of 10 pages is used. Otherwise, it is read and respected.
It might be worth evaluating other XMLRPC methods that have "optional" method arguments, to make sure they behave as expected under PHP 5.
Change History (7)
- Summary changed from wp_getPages fails on PHP5 with no page count parameter to wp_getPages failsif WP_DEBUG is set, and no page count parameter provided
- Summary changed from wp_getPages failsif WP_DEBUG is set, and no page count parameter provided to wp_getPages fails if WP_DEBUG is set, and no page count parameter provided
- Owner changed from josephscott to westi
- Status changed from new to reviewing