From da101ed1ec824440a1990a67f7c8e2395a051883 Mon Sep 17 00:00:00 2001 From: ozh Date: Wed, 25 Dec 2013 14:08:42 +0100 Subject: [PATCH] Use clone to break object refs. Don't ask. Stolen from people smarter than me: - http://core.trac.wordpress.org/changeset/9740 - http://core.trac.wordpress.org/changeset/14777 - http://core.trac.wordpress.org/ticket/13480 (cherry picked from commit 09b989d375bac65e692277f61a84fede2fb04ae3) --- includes/functions.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/includes/functions.php b/includes/functions.php index 0126e93..0b747fc 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1049,6 +1049,13 @@ function yourls_get_all_options() { function yourls_update_option( $option_name, $newvalue ) { global $ydb; $table = YOURLS_DB_TABLE_OPTIONS; + + $option_name = trim( $option_name ); + if ( empty( $option_name ) ) + return false; + + if ( is_object( $newvalue ) ) + $newvalue = clone $newvalue; $safe_option_name = yourls_escape( $option_name ); @@ -1089,6 +1096,14 @@ function yourls_update_option( $option_name, $newvalue ) { function yourls_add_option( $name, $value = '' ) { global $ydb; $table = YOURLS_DB_TABLE_OPTIONS; + + $name = trim( $name ); + if ( empty( $name ) ) + return false; + + if ( is_object( $value ) ) + $value = clone $value; + $safe_name = yourls_escape( $name ); // Make sure the option doesn't already exist -- 2.45.0