From 01a4c0d827dac4867cf500e47007f15c02910e3d Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 17 Feb 2008 19:29:07 +0000 Subject: - Patch #222385 by pwolanin: removed drupal_clone() hack in favor of the real PHP5 clone(). --- INSTALL.txt | 2 +- includes/common.inc | 7 ------- modules/contact/contact.pages.inc | 2 +- modules/node/node.module | 6 +++--- modules/node/node.pages.inc | 4 ++-- modules/taxonomy/taxonomy.module | 2 +- 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/INSTALL.txt b/INSTALL.txt index a02d19c9d..2dd21220a 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -18,7 +18,7 @@ Drupal requires a web server, PHP 4 (4.3.5 or greater) or PHP 5 (http://www.php.net/) and either MySQL (http://www.mysql.com/) or PostgreSQL (http://www.postgresql.org/). The Apache web server and MySQL database are recommended; other web server and database combinations such as IIS and -PostgreSQL have been tested to a lesser extent. When using MySQL, version 4.1.1 +PostgreSQL have been tested to a lesser extent. When using MySQL, version 5.0 or greater is recommended to assure you can safely transfer the database. For more detailed information about Drupal requirements, see "Requirements" diff --git a/includes/common.inc b/includes/common.inc index 789a01673..3e41439f0 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -1567,13 +1567,6 @@ function base_path() { return $GLOBALS['base_path']; } -/** - * Provide a substitute clone() function for PHP4. - */ -function drupal_clone($object) { - return version_compare(phpversion(), '5.0') < 0 ? $object : clone($object); -} - /** * Add a tag to the page's HEAD. */ diff --git a/modules/contact/contact.pages.inc b/modules/contact/contact.pages.inc index dc7d631c9..82d1bb95f 100644 --- a/modules/contact/contact.pages.inc +++ b/modules/contact/contact.pages.inc @@ -106,7 +106,7 @@ function contact_mail_page() { */ function contact_mail_page_validate($form, &$form_state) { if (!$form_state['values']['cid']) { - form_set_error('category', t('You must select a valid category.')); + form_set_error('cid', t('You must select a valid category.')); } if (!valid_email_address($form_state['values']['mail'])) { form_set_error('mail', t('You must enter a valid e-mail address.')); diff --git a/modules/node/node.module b/modules/node/node.module index 77c2c875e..54160f8a3 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -707,7 +707,7 @@ function node_load($param = array(), $revision = NULL, $reset = NULL) { if ($cachable) { // Is the node statically cached? if (isset($nodes[$param])) { - return is_object($nodes[$param]) ? drupal_clone($nodes[$param]) : $nodes[$param]; + return is_object($nodes[$param]) ? clone $nodes[$param] : $nodes[$param]; } } $cond = 'n.nid = %d'; @@ -764,7 +764,7 @@ function node_load($param = array(), $revision = NULL, $reset = NULL) { } } if ($cachable) { - $nodes[$node->nid] = is_object($node) ? drupal_clone($node) : $node; + $nodes[$node->nid] = is_object($node) ? clone $node : $node; } } @@ -2724,7 +2724,7 @@ function node_unpublish_by_keyword_action_submit($form, $form_state) { */ function node_unpublish_by_keyword_action($node, $context) { foreach ($context['keywords'] as $keyword) { - if (strstr(node_view(drupal_clone($node)), $keyword) || strstr($node->title, $keyword)) { + if (strstr(node_view(clone $node), $keyword) || strstr($node->title, $keyword)) { $node->status = 0; watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_get_types('name', $node), '%title' => $node->title)); break; diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc index aef2308c7..dc3e529cb 100644 --- a/modules/node/node.pages.inc +++ b/modules/node/node.pages.inc @@ -394,7 +394,7 @@ function node_preview($node) { // Display a preview of the node. // Previewing alters $node so it needs to be cloned. if (!form_get_errors()) { - $cloned_node = drupal_clone($node); + $cloned_node = clone $node; $cloned_node->build_mode = NODE_BUILD_PREVIEW; $output = theme('node_preview', $cloned_node); } @@ -432,7 +432,7 @@ function theme_node_preview($node) { if ($preview_trimmed_version) { drupal_set_message(t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. You can insert the delimiter "<!--break-->" (without the quotes) to fine-tune where your post gets split.')); $output .= '

'. t('Preview trimmed version') .'

'; - $output .= node_view(drupal_clone($node), 1, FALSE, 0); + $output .= node_view(clone $node, 1, FALSE, 0); $output .= '

'. t('Preview full version') .'

'; $output .= node_view($node, 0, FALSE, 0); } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index af40899a5..d649a7bc6 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -838,7 +838,7 @@ function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) { if (!empty($children[$vid][$parent])) { foreach ($children[$vid][$parent] as $child) { if ($max_depth > $depth) { - $term = drupal_clone($terms[$vid][$child]); + $term = clone $terms[$vid][$child]; $term->depth = $depth; // The "parent" attribute is not useful, as it would show one parent only. unset($term->parent); -- cgit v1.2.3