From 9f2545b95d00613a1bf0c96375e651b47cd010cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= <rdoursenaud@gpcsolutions.fr>
Date: Thu, 24 Sep 2015 16:32:48 +0200
Subject: [PATCH] [Qual] Replaced deprecated dol_clone by native clone

---
 .../canvas/actions_adherentcard_common.class.php       |  3 +--
 htdocs/adherents/card.php                              |  2 +-
 htdocs/comm/action/class/actioncomm.class.php          |  4 ++--
 .../askpricesupplier/class/askpricesupplier.class.php  |  4 ++--
 htdocs/comm/propal/class/propal.class.php              |  4 ++--
 htdocs/commande/card.php                               |  2 +-
 htdocs/commande/class/commande.class.php               |  2 +-
 htdocs/compta/facture/class/facture.class.php          |  2 +-
 .../canvas/actions_contactcard_common.class.php        |  2 +-
 htdocs/contact/card.php                                |  2 +-
 htdocs/core/class/fileupload.class.php                 |  2 +-
 htdocs/core/class/html.formfile.class.php              |  4 +++-
 htdocs/core/lib/functions.lib.php                      |  2 +-
 htdocs/core/menus/standard/empty.php                   |  4 ++--
 .../interface_50_modLdap_Ldapsynchro.class.php         | 10 +++++-----
 htdocs/exports/class/export.class.php                  |  2 +-
 htdocs/fourn/class/fournisseur.commande.class.php      |  4 ++--
 htdocs/product/card.php                                |  2 +-
 htdocs/product/fournisseurs.php                        |  2 +-
 htdocs/product/stock/class/mouvementstock.class.php    |  2 +-
 htdocs/projet/card.php                                 |  2 +-
 htdocs/projet/tasks/contact.php                        |  2 +-
 htdocs/projet/tasks/document.php                       |  2 +-
 htdocs/projet/tasks/note.php                           |  2 +-
 htdocs/projet/tasks/task.php                           |  2 +-
 htdocs/projet/tasks/time.php                           |  2 +-
 htdocs/societe/canvas/actions_card_common.class.php    |  2 +-
 htdocs/societe/soc.php                                 |  4 ++--
 htdocs/user/card.php                                   |  6 +++---
 htdocs/user/class/user.class.php                       |  2 +-
 htdocs/user/group/card.php                             |  4 ++--
 test/phpunit/ContactTest.php                           |  2 +-
 test/phpunit/HolidayTest.php                           |  2 +-
 33 files changed, 48 insertions(+), 47 deletions(-)

diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
index 6a8660c7f46..06574f7ae10 100644
--- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php
+++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
@@ -211,7 +211,7 @@ abstract class ActionsAdherentCardCommon
             {
                 $this->object->fetch($_POST["adherentid"]);
 
-                $this->object->oldcopy=dol_clone($this->object);
+				$this->object->oldcopy = clone $this->object;
 
                 $this->assign_post();
 
@@ -434,4 +434,3 @@ abstract class ActionsAdherentCardCommon
     }
 
 }
-
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index a74e19648ea..ae727476f3d 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -268,7 +268,7 @@ if (empty($reshook))
 		// Create new object
 		if ($result > 0 && ! $error)
 		{
-			$object->oldcopy=dol_clone($object);
+			$object->oldcopy = clone $object;
 
 			// Change values
 			$object->civility_id = trim($_POST["civility_id"]);
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 9d793e16ba0..463f778537b 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -409,8 +409,8 @@ class ActionComm extends CommonObject
 
         $this->db->begin();
 
-        // Load source object
-        $objFrom = dol_clone($this);
+		// Load source object
+		$objFrom = clone $this;
 
 		$this->fetch_optionals();
 		$this->fetch_userassigned();
diff --git a/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php b/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php
index bee62cb384d..83333ca5167 100644
--- a/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php
+++ b/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php
@@ -950,8 +950,8 @@ class AskPriceSupplier extends CommonObject
 		foreach($this->lines as $line)
 			$line->fetch_optionals($line->rowid);
 
-        // Load source object
-        $objFrom = dol_clone($this);
+		// Load source object
+		$objFrom = clone $this;
 
         $objsoc=new Societe($this->db);
 
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 421b2506e73..418e0e473a4 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -647,7 +647,7 @@ class Propal extends CommonObject
             $line = new PropaleLigne($this->db);
             $line->fetch($rowid);
 
-            $staticline = clone $line;
+			$staticline = clone $line;
 
             $line->oldline = $staticline;
             $this->line = $line;
@@ -1077,7 +1077,7 @@ class Propal extends CommonObject
 			$line->fetch_optionals($line->rowid);
 
         // Load source object
-        $objFrom = dol_clone($this);
+        $objFrom = clone $this;
 
         $objsoc=new Societe($this->db);
 
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 83b86ee5525..695f1505065 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -129,7 +129,7 @@ if (empty($reshook))
 			if ($object->id > 0)
 			{
 				// Because createFromClone modifies the object, we must clone it so that we can restore it later
-				$orig = dol_clone($object);
+				$orig = clone $object;
 
 				$result=$object->createFromClone($socid);
 				if ($result > 0)
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 32fe2d52726..d2c0b6c1fc4 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -958,7 +958,7 @@ class Commande extends CommonOrder
 			$line->fetch_optionals($line->rowid);
 
         // Load source object
-        $objFrom = dol_clone($this);
+        $objFrom = clone $this;
 
         // Change socid if needed
         if (! empty($socid) && $socid != $this->socid)
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 3d1558118c1..da985d33b17 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -701,7 +701,7 @@ class Facture extends CommonInvoice
 			$line->fetch_optionals($line->rowid);
 
 		// Load source object
-		$objFrom = dol_clone($this);
+		$objFrom = clone $this;
 
 
 
diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php
index ad628fd6574..7e43270a32c 100644
--- a/htdocs/contact/canvas/actions_contactcard_common.class.php
+++ b/htdocs/contact/canvas/actions_contactcard_common.class.php
@@ -207,7 +207,7 @@ abstract class ActionsContactCardCommon
             {
                 $this->object->fetch($_POST["contactid"]);
 
-                $this->object->oldcopy=dol_clone($this->object);
+				$this->object->oldcopy = clone $this->object;
 
                 $this->assign_post();
 
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index 9778d0c8a71..dedf79afa33 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -289,7 +289,7 @@ if (empty($reshook))
 
             $object->fetch($contactid);
 
-            $object->oldcopy=dol_clone($object);
+			$object->oldcopy = clone$object;
 
             $object->old_lastname	= GETPOST("old_lastname");
             $object->old_firstname	= GETPOST("old_firstname");
diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php
index cdb7f66ac5f..a38b034747b 100644
--- a/htdocs/core/class/fileupload.class.php
+++ b/htdocs/core/class/fileupload.class.php
@@ -125,7 +125,7 @@ class FileUpload
 			if (!empty($parent->socid)) {
 				$parent->fetch_thirdparty();
 			}
-			$object->$parentObject = dol_clone($parent);
+			$object->$parentObject = clone $parent;
 		} else {
 			$object->fetch_thirdparty();
 		}
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 59a418d73a2..b2e06f91550 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1083,7 +1083,9 @@ class FormFile
                         }
                     }
 
-                    if ($result > 0)  { $found=1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]=dol_clone($object_instance); }    // Save object into a cache
+					if ($result > 0) {  // Save object into a cache
+						$found=1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = clone $object_instance;
+					}
                     if ($result == 0) { $found=1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]='notfound'; unset($filearray[$key]); }
                 }
 
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 0ae89d01274..810576d8bfa 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -397,7 +397,7 @@ function dol_clone($object)
 {
 	dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
 
-	$myclone=clone($object);
+	$myclone = clone $object;
 	return $myclone;
 }
 
diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php
index 866e01b4959..5c428ca9f13 100644
--- a/htdocs/core/menus/standard/empty.php
+++ b/htdocs/core/menus/standard/empty.php
@@ -99,7 +99,7 @@ class MenuManager
 
 			if ($mode == 'jmobile')
 			{
-				$this->topmenu=dol_clone($this->menu);
+				$this->topmenu = clone $this->menu;
 				unset($this->menu->liste);
 			}
 		}
@@ -205,7 +205,7 @@ class MenuManager
 
 			if ($mode == 'jmobile')
 			{
-				$this->leftmenu=dol_clone($this->menu);
+				$this->leftmenu = clone $this->menu;
 				unset($this->menu->liste);
 			}
 		}
diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php
index 652a1ec8d6b..7a63a5cdeec 100644
--- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php
+++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php
@@ -89,7 +89,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
         	    if (empty($object->oldcopy) || ! is_object($object->oldcopy))
                 {
                 	dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
-                	$object->oldcopy=dol_clone($object);
+					$object->oldcopy = clone $object;
                 }
 
         		$oldinfo=$object->oldcopy->_load_ldap_info();
@@ -126,7 +126,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
                 if (empty($object->oldcopy) || ! is_object($object->oldcopy))
                 {
                 	dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
-                	$object->oldcopy=dol_clone($object);
+					$object->oldcopy = clone $object;
                 }
 
                 $oldinfo=$object->oldcopy->_load_ldap_info();
@@ -287,7 +287,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
         	    if (empty($object->oldcopy) || ! is_object($object->oldcopy))
                 {
                 	dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
-                	$object->oldcopy=dol_clone($object);
+					$object->oldcopy = clone $object;
                 }
 
         		$oldinfo=$object->oldcopy->_load_ldap_info();
@@ -364,7 +364,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
         	    if (empty($object->oldcopy) || ! is_object($object->oldcopy))
                 {
                 	dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
-                	$object->oldcopy=dol_clone($object);
+					$object->oldcopy = clone $object;
                 }
 
         		$oldinfo=$object->oldcopy->_load_ldap_info();
@@ -493,7 +493,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
         	    if (empty($object->oldcopy) || ! is_object($object->oldcopy))
                 {
                 	dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
-                	$object->oldcopy=dol_clone($object);
+					$object->oldcopy = clone $object;
                 }
 
         		$oldinfo=$object->oldcopy->_load_ldap_info();
diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php
index 5602829a908..88e4ecc8596 100644
--- a/htdocs/exports/class/export.class.php
+++ b/htdocs/exports/class/export.class.php
@@ -556,7 +556,7 @@ class Export
 			$filename.='.'.$objmodel->getDriverExtension();
 			$dirname=$conf->export->dir_temp.'/'.$user->id;
 
-			$outputlangs=dol_clone($langs);	// We clone to have an object we can modify (for example to change output charset by csv handler) without changing original value
+			$outputlangs = clone $langs; // We clone to have an object we can modify (for example to change output charset by csv handler) without changing original value
 
 			// Open file
 			dol_mkdir($dirname);
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 233c0510b3a..7b028ec89a1 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -1137,8 +1137,8 @@ class CommandeFournisseur extends CommonOrder
 
 		$this->db->begin();
 
-        // Load source object
-        $objFrom = dol_clone($this);
+		// Load source object
+		$objFrom = clone $this;
 
         $this->id=0;
         $this->statut=0;
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 18e0153ed77..5ccc59c9798 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -315,7 +315,7 @@ if (empty($reshook))
         {
             if ($object->id > 0)
             {
-            	$object->oldcopy=dol_clone($object);
+				$object->oldcopy= clone $object;
 
                 $object->ref                    = $ref;
                 $object->label                  = GETPOST('label');
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 866abd856b1..a2908dc228a 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -399,7 +399,7 @@ if ($id || $ref)
 
 				// We don't have supplier, so we try to guess.
 				// For this we build a fictive supplier with same properties than user but using vat)
-				$mysoc2=dol_clone($mysoc);
+				$mysoc2 = clone $mysoc;
 				$mysoc2->name='Fictive seller with same country';
 				$mysoc2->tva_assuj=1;
 				$default_vat=get_default_tva($mysoc2, $mysoc, $product->id, 0);
diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php
index a612b7137cd..b2dd1e9b83b 100644
--- a/htdocs/product/stock/class/mouvementstock.class.php
+++ b/htdocs/product/stock/class/mouvementstock.class.php
@@ -433,7 +433,7 @@ class MouvementStock extends CommonObject
 		// Create movement for each subproduct
 		foreach($pids as $key => $value)
 		{
-			$tmpmove = dol_clone($this);
+			$tmpmove = clone $this;
 			$tmpmove->_create($user, $pids[$key], $entrepot_id, ($qty * $pqtys[$key]), $type, 0, $label, $inventorycode);		// This will also call _createSubProduct making this recursive
 			unset($tmpmove);
 		}
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index 24968839960..c62591b9344 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -218,7 +218,7 @@ if (empty($reshook))
 
 	    if (! $error)
 	    {
-	        $object->oldcopy = dol_clone($object);
+			$object->oldcopy = clone $object;
 
 			$old_start_date = $object->date_start;
 
diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php
index 9a8aa5c5608..59dab34b33e 100644
--- a/htdocs/projet/tasks/contact.php
+++ b/htdocs/projet/tasks/contact.php
@@ -176,7 +176,7 @@ if ($id > 0 || ! empty($ref))
 		$result=$projectstatic->fetch($object->fk_project);
 		if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
 
-		$object->project = dol_clone($projectstatic);
+		$object->project = clone $projectstatic;
 
 		$userWrite  = $projectstatic->restrictedProjectArea($user,'write');
 
diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php
index ee3b9288d3c..1afc949cfa0 100644
--- a/htdocs/projet/tasks/document.php
+++ b/htdocs/projet/tasks/document.php
@@ -98,7 +98,7 @@ if ($id > 0 || ! empty($ref))
 			$projectstatic->fetch_thirdparty();
 		}
 
-		$object->project = dol_clone($projectstatic);
+		$object->project = clone $projectstatic;
 
 		$upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref);
 	}
diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php
index 5b479085f61..ba575be30ad 100644
--- a/htdocs/projet/tasks/note.php
+++ b/htdocs/projet/tasks/note.php
@@ -53,7 +53,7 @@ if ($id > 0 || ! empty($ref))
 		$projectstatic->fetch($object->fk_project);
 		if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
 
-		$object->project = dol_clone($projectstatic);
+		$object->project = clone $projectstatic;
 	}
 	else
 	{
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 8a3c3cc5d5b..a146d8805ea 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -205,7 +205,7 @@ if ($id > 0 || ! empty($ref))
 		$result=$projectstatic->fetch($object->fk_project);
 		if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
 
-		$object->project = dol_clone($projectstatic);
+		$object->project = clone $projectstatic;
 
 		$userWrite  = $projectstatic->restrictedProjectArea($user,'write');
 
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index f5eab2587cf..db8682e095a 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -215,7 +215,7 @@ if ($id > 0 || ! empty($ref))
 		$result=$projectstatic->fetch($object->fk_project);
 		if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
 
-		$object->project = dol_clone($projectstatic);
+		$object->project = clone $projectstatic;
 
 		$userWrite = $projectstatic->restrictedProjectArea($user,'write');
 
diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php
index b2b0f954a58..bffff8f3cbe 100644
--- a/htdocs/societe/canvas/actions_card_common.class.php
+++ b/htdocs/societe/canvas/actions_card_common.class.php
@@ -279,7 +279,7 @@ abstract class ActionsCardCommon
                         exit;
                     }
 
-                    $oldsoccanvas = dol_clone($this->object);
+					$oldsoccanvas = clone $this->object;
 
                     // To avoid setting code if third party is not concerned. But if it had values, we keep them.
                     if (empty($this->object->client) && empty($oldsoccanvas->code_client))             $this->object->code_client='';
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 637110d4a88..8e703118e59 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -232,7 +232,7 @@ if (empty($reshook))
         if ($action == 'update')
         {
         	$ret=$object->fetch($socid);
-        	$object->oldcopy=dol_clone($object);
+			$object->oldcopy = clone $object;
         }
 		else $object->canvas=$canvas;
 
@@ -1329,7 +1329,7 @@ else
                 $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed();
             }
 
-            $object->oldcopy=dol_clone($object);
+			$object->oldcopy = clone $object;
 
             if (GETPOST('name'))
             {
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index 5724101ec1b..6f4487f9947 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -278,7 +278,7 @@ if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield)
     {
         $editgroup = new UserGroup($db);
         $editgroup->fetch($group);
-        $editgroup->oldcopy=clone($editgroup);
+		$editgroup->oldcopy=clone $editgroup;
 
         $object->fetch($id);
         if ($action == 'addgroup')    $object->SetInGroup($group,($conf->multicompany->transverse_mode?GETPOST("entity"):$editgroup->entity));
@@ -340,7 +340,7 @@ if ($action == 'update' && ! $_POST["cancel"])
        {
             $db->begin();
 
-            $object->oldcopy=clone($object);
+			$object->oldcopy = clone $object;
 
             $object->lastname	= GETPOST("lastname",'alpha');
             $object->firstname	= GETPOST("firstname",'alpha');
@@ -508,7 +508,7 @@ if ($action == 'update' && ! $_POST["cancel"])
     {
         $object->fetch($id);
 
-        $object->oldcopy=clone($object);
+		$object->oldcopy = clone $object;
 
         $ret=$object->setPassword($user,$_POST["password"]);
         if ($ret < 0)
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 34c3084e12d..d7eb96363d8 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -1409,7 +1409,7 @@ class User extends CommonObject
 		// Mise a jour
 		if (! $changelater)
 		{
-		    if (! is_object($this->oldcopy)) $this->oldcopy=dol_clone($this);
+		    if (! is_object($this->oldcopy)) $this->oldcopy = clone $this;
 
 		    $this->db->begin();
 
diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php
index 3de421e4f4f..05acd6a5a45 100644
--- a/htdocs/user/group/card.php
+++ b/htdocs/user/group/card.php
@@ -142,7 +142,7 @@ if ($action == 'adduser' || $action =='removeuser')
         if ($userid)
         {
             $object->fetch($id);
-            $object->oldcopy=dol_clone($object);
+			$object->oldcopy = clone $object;
 
 			$edituser = new User($db);
 			$edituser->fetch($userid);
@@ -176,7 +176,7 @@ if ($action == 'update')
 
         $object->fetch($id);
 
-        $object->oldcopy=dol_clone($object);
+		$object->oldcopy = clone $object;
 
 		$object->name	= trim($_POST["group"]);
 		$object->nom	= $object->name;			// For backward compatibility
diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php
index b638cdc776b..6fb3069d2af 100755
--- a/test/phpunit/ContactTest.php
+++ b/test/phpunit/ContactTest.php
@@ -189,7 +189,7 @@ class ContactTest extends PHPUnit_Framework_TestCase
 		$langs=$this->savlangs;
 		$db=$this->savdb;
 
-		$localobject->oldcopy=dol_clone($localobject);
+		$localobject->oldcopy = clone $localobject;
 
 		$localobject->note_private='New private note after update';
 		$localobject->note_public='New public note after update';
diff --git a/test/phpunit/HolidayTest.php b/test/phpunit/HolidayTest.php
index 36556fd9281..065d3678d8e 100644
--- a/test/phpunit/HolidayTest.php
+++ b/test/phpunit/HolidayTest.php
@@ -183,7 +183,7 @@ class HolidayTest extends PHPUnit_Framework_TestCase
 		$langs=$this->savlangs;
 		$db=$this->savdb;
 
-		$localobject->oldcopy=dol_clone($localobject);
+		$localobject->oldcopy = clone $localobject;
 
 		$localobject->note_private='New private note after update';
 		$localobject->note_public='New public note after update';
-- 
GitLab