diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
index 6a8660c7f467510e27b1af96d1021a0d52ab9fd4..06574f7ae107df2ddad3690bfa6ce6726981cb98 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 a74e19648ea6f024be0fcfa2bda16a2a0e0e1e62..ae727476f3d4945dba17553244be5637e1603bbf 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 9d793e16ba080814572d6fe4f34cfff8330878f5..463f778537b54c9b5a70951691cc527ceab2e416 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 bee62cb384dd680f52d32be56192cfe873cb5cbc..83333ca516746c61a2fc1d10af53329a77638304 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 421b2506e7388ffc82cb8d126062c4a39146cb98..418e0e473a45c847880954397d80777cd4d8bb63 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 83b86ee5525accf3550ea3e17cf4302fe9869de5..695f15050654b5bc8c29329fd866995ed18d3b96 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 32fe2d52726a3f920da6778f9123a44a3ca0dc02..d2c0b6c1fc4e21e3fc0ec5ff94061f36789cb555 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 3d1558118c1e5d5bf6f1ada1c5d676867fd31661..da985d33b1796190b06b4635ab145fe17195e3b2 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 ad628fd65747c9bf4ec3f3f5fa7b9d2e075a7215..7e43270a32c88589eb00d2a2f695da38d38443e9 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 9778d0c8a7113bf47ecd7dd519719c18c4dafa5f..dedf79afa337403c2e5000ca6a632756f6d8b2d4 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 cdb7f66ac5ff3e8acebe5922f9ca0330f907d205..a38b034747b53420895cd8f9312b5eac68b5f320 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 59a418d73a216a3a356e7d774245f2bd08469bd5..b2e06f915505f9363f5a1f006aba8eb9a3922ac2 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 0ae89d012747f1254e6669ddbb671c010298c766..810576d8bfae57068414515541cb3cb79bc79e20 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 866e01b49592b6655ee890550555094c5df4becf..5c428ca9f136678a13b89128a12ff22bffe5dea7 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 652a1ec8d6b440ab58741c2d690d6bf43cffa214..7a63a5cdeecbab3a8220e0b6a942a3920a46472c 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 5602829a908f804df07d420df229e81ff72d68f2..88e4ecc8596534615745b1ba28c2459b1a99e1cb 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 233c0510b3a19cebe334c1605f9fcdfdb73bebd1..7b028ec89a1548b1df46668fda95181aa0cc5e90 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 18e0153ed777ed2673a3473b79f55f770eac1e5b..5ccc59c97982c91541da03ee42e851eafa03cd69 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 866abd856b1d6b378d3c9b4612c7d613010abd7d..a2908dc228a80cefba606d44945e62b0c0978434 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 a612b7137cd3b33d888a33807d6c467373d115d0..b2dd1e9b83b52c897cf0f1af531d2b12e90c1aca 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 249688399609de42b31600d685e351d227407c48..c62591b93444dd97e447e7d2c963c16a84d95db4 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 9a8aa5c56084c34c1906bbded21a8adaebb03b03..59dab34b33e414b20661ad2c2b942e46517a1cdb 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 ee3b9288d3c988a0cfa46e65c889b3254256aab1..1afc949cfa0b509dbac4c4942b72de3c79129f8d 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 5b479085f6136bf36bba2ce33e17bea708c93745..ba575be30ad9100d1d070c6920b055c5c775c36b 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 8a3c3cc5d5b01bd2f1fd2343c6d2a2f2c35ddb35..a146d8805eaaf5d564782fecde0b203c0dba4710 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 f5eab2587cfe31f33bf6440ae3ffb71fe7360839..db8682e095a50e30a3e203e9a67295f8b9f665d4 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 b2b0f954a588a822f2d59a3a6787c0f994de5fcc..bffff8f3cbe045cc8a2a6dcec8e5a865321f449e 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 637110d4a88e8f947cd171898d36640dfd2af30a..8e703118e593e9ec8f2dfda6ce54133679d45b32 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 5724101ec1b776d6352efc56948dc091010efeec..6f4487f9947c175987bab8b4e7e27bd676eb5a17 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 34c3084e12d98638483427f441108776f55d442b..d7eb96363d8b4657a9b205a54d33feb2fdd3f425 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 3de421e4f4f12bb08e62b06363403dc32c33a97d..05acd6a5a45847a46d7923b8c9b35d67197f3d25 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 b638cdc776bfe430120d34d8005f10c25f75be0e..6fb3069d2af997b85273eb0c0feff0bc88282735 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 36556fd92819799eb212928aaa2be42e749c2b19..065d3678d8e5007b62827da1810e9bf255fb1cb5 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';