From a9dc60c9a89c1091be5274519c16e41b881b33f1 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 21 Aug 2013 21:11:09 +0000 Subject: [PATCH] Improve inline docs for function params that can be serialized when non-scalar. Fixes #18488. Built from https://develop.svn.wordpress.org/trunk@25076 git-svn-id: http://core.svn.wordpress.org/trunk@25061 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/meta.php | 12 ++++++------ wp-includes/option.php | 6 +++--- wp-includes/post.php | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/wp-includes/meta.php b/wp-includes/meta.php index 22b03157ae..ac396a118b 100644 --- a/wp-includes/meta.php +++ b/wp-includes/meta.php @@ -22,7 +22,7 @@ * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user) * @param int $object_id ID of the object metadata is for * @param string $meta_key Metadata key - * @param string $meta_value Metadata value + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. * @param bool $unique Optional, default is false. Whether the specified metadata key should be * unique for the object. If true, and the object already has a value for the specified * metadata key, no change will be made @@ -93,8 +93,8 @@ function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user) * @param int $object_id ID of the object metadata is for * @param string $meta_key Metadata key - * @param string $meta_value Metadata value - * @param string $prev_value Optional. If specified, only update existing metadata entries with + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. + * @param mixed $prev_value Optional. If specified, only update existing metadata entries with * the specified value. Otherwise, update all entries. * @return bool True on successful update, false on failure. */ @@ -174,7 +174,7 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user) * @param int $object_id ID of the object metadata is for * @param string $meta_key Metadata key - * @param string $meta_value Optional. Metadata value. If specified, only delete metadata entries + * @param mixed $meta_value Optional. Metadata value. Must be serializable if non-scalar. If specified, only delete metadata entries * with this value. Otherwise, delete all entries with the specified meta_key. * @param bool $delete_all Optional, default is false. If true, delete matching metadata entries * for all objects, ignoring the specified object_id. Otherwise, only delete matching @@ -720,8 +720,8 @@ class WP_Meta_Query { $key_only_queries[$k] = $q; unset( $this->queries[$k] ); } - } - + } + // Split out the meta_key only queries (we can only do this for OR) if ( 'OR' == $this->relation ) { foreach ( $this->queries as $k => $q ) { diff --git a/wp-includes/option.php b/wp-includes/option.php index 385ba89253..eabb677525 100644 --- a/wp-includes/option.php +++ b/wp-includes/option.php @@ -208,7 +208,7 @@ function wp_load_core_site_options( $site_id = null ) { * @uses do_action() Calls 'update_option_$option' and 'updated_option' hooks on success. * * @param string $option Option name. Expected to not be SQL-escaped. - * @param mixed $newvalue Option value. Expected to not be SQL-escaped. + * @param mixed $newvalue Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped. * @return bool False if value was not updated and true if value was updated. */ function update_option( $option, $newvalue ) { @@ -284,7 +284,7 @@ function update_option( $option, $newvalue ) { * @uses do_action() Calls 'add_option_$option' and 'added_option' hooks on success. * * @param string $option Name of option to add. Expected to not be SQL-escaped. - * @param mixed $value Optional. Option value, can be anything. Expected to not be SQL-escaped. + * @param mixed $value Optional. Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped. * @param mixed $deprecated Optional. Description. Not used anymore. * @param bool $autoload Optional. Default is enabled. Whether to load the option when WordPress starts up. * @return bool False if option was not added and true if option was added. @@ -488,7 +488,7 @@ function get_transient( $transient ) { * @uses do_action() Calls 'set_transient_$transient' and 'setted_transient' hooks on success. * * @param string $transient Transient name. Expected to not be SQL-escaped. - * @param mixed $value Transient value. Expected to not be SQL-escaped. + * @param mixed $value Transient value. Must be serializable if non-scalar. Expected to not be SQL-escaped. * @param int $expiration Time until expiration in seconds, default 0 * @return bool False if value was not set and true if value was set. */ diff --git a/wp-includes/post.php b/wp-includes/post.php index a22765c7d3..5eea14e3bb 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1671,7 +1671,7 @@ function get_posts($args = null) { * * @param int $post_id Post ID. * @param string $meta_key Metadata name. - * @param mixed $meta_value Metadata value. + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. * @param bool $unique Optional, default is false. Whether the same key should not be added. * @return int|bool Meta ID on success, false on failure. */ @@ -1695,7 +1695,7 @@ function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) { * * @param int $post_id post ID * @param string $meta_key Metadata name. - * @param mixed $meta_value Optional. Metadata value. + * @param mixed $meta_value Optional. Metadata value. Must be serializable if non-scalar. * @return bool True on success, false on failure. */ function delete_post_meta($post_id, $meta_key, $meta_value = '') { @@ -1735,7 +1735,7 @@ function get_post_meta($post_id, $key = '', $single = false) { * * @param int $post_id Post ID. * @param string $meta_key Metadata key. - * @param mixed $meta_value Metadata value. + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. * @param mixed $prev_value Optional. Previous value to check before removing. * @return bool True on success, false on failure. */