From 251cb2b0e2062134126fb9419c8feb5dc4aeb0c4 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Fri, 28 Apr 2017 10:22:01 +0200 Subject: [PATCH] Use call_user_func_array() instead of call_user_func() when need to permit arg by reference --- public_html/custom_search_action.php | 2 +- .../includes/class/class.LSattr_ldap_password.php | 2 +- public_html/includes/class/class.LSattribute.php | 10 +++++----- public_html/includes/class/class.LSform.php | 2 +- .../includes/class/class.LSformRule_callable.php | 2 +- public_html/includes/class/class.LSldapObject.php | 10 +++++----- public_html/includes/class/class.LSrelation.php | 10 +++++----- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/public_html/custom_search_action.php b/public_html/custom_search_action.php index 81b1584b..0f4cdd4d 100644 --- a/public_html/custom_search_action.php +++ b/public_html/custom_search_action.php @@ -44,7 +44,7 @@ if(LSsession :: startLSsession()) { } if (isset($_GET['valid']) || $config['noConfirmation']) { LStemplate :: assign('pagetitle',$title); - if (call_user_func($config['function'],$LSsearch)) { + if (call_user_func_array($config['function'],array(&$LSsearch))) { if ($config['disableOnSuccessMsg']!=true) { if ($config['onSuccessMsgFormat']) { LSsession :: addInfo(getFData(__($config['onSuccessMsgFormat']),$objectname)); diff --git a/public_html/includes/class/class.LSattr_ldap_password.php b/public_html/includes/class/class.LSattr_ldap_password.php index 9d721186..c8b8470a 100644 --- a/public_html/includes/class/class.LSattr_ldap_password.php +++ b/public_html/includes/class/class.LSattr_ldap_password.php @@ -190,7 +190,7 @@ class LSattr_ldap_password extends LSattr_ldap { return $clearPassword; break; case 'function': - return call_user_func($this -> config['ldap_options']['encode_function'], $this -> attribute -> ldapObject, $clearPassword); + return call_user_func_array($this -> config['ldap_options']['encode_function'], array(&$this -> attribute -> ldapObject, $clearPassword)); break; } LSerror :: addErrorCode('LSattr_ldap_password_01',$this -> config['ldap_options']['encode']); diff --git a/public_html/includes/class/class.LSattribute.php b/public_html/includes/class/class.LSattribute.php index 7ce4dfe7..63ad1850 100644 --- a/public_html/includes/class/class.LSattribute.php +++ b/public_html/includes/class/class.LSattribute.php @@ -495,7 +495,7 @@ class LSattribute { function generateValue() { $value=false; if (function_exists($this -> config['generate_function'])) { - $value=call_user_func($this -> config['generate_function'],$this -> ldapObject); + $value=call_user_func_array($this -> config['generate_function'],array(&$this -> ldapObject)); } else if (isset($this -> config['generate_value_format'])) { $value = $this -> ldapObject -> getFData($this -> config['generate_value_format']); @@ -649,7 +649,7 @@ class LSattribute { } foreach($funcs as $func) { if(function_exists($func)) { - if(!call_user_func($func, $this -> ldapObject)) { + if(!call_user_func_array($func, array(&$this -> ldapObject))) { $return = false; } } @@ -666,7 +666,7 @@ class LSattribute { $obj = new $e['class'](); if (method_exists($obj,$e['fct'])) { try { - call_user_func(array($obj, $e['fct']), $e['params']); + call_user_func_array(array($obj, $e['fct']), array(&$e['params'])); } catch(Exception $er) { $return = false; @@ -686,7 +686,7 @@ class LSattribute { else { if (function_exists($e['fct'])) { try { - call_user_func($e['fct'], $e['params']); + call_user_func_array($e['fct'], array(&$e['params'])); } catch(Exception $er) { LSdebug("Event ".$event." : Erreur durant l'execution de la function ".$e['fct']); @@ -705,7 +705,7 @@ class LSattribute { foreach ($this -> _objectEvents[$event] as $e) { if (method_exists($e['obj'],$e['meth'])) { try { - call_user_func(array($e['obj'], $e['meth']),$e['params']); + call_user_func_array(array($e['obj'], $e['meth']),array(&$e['params'])); } catch(Exception $er) { $return = false; diff --git a/public_html/includes/class/class.LSform.php b/public_html/includes/class/class.LSform.php index c3d55273..c0921c8b 100644 --- a/public_html/includes/class/class.LSform.php +++ b/public_html/includes/class/class.LSform.php @@ -362,7 +362,7 @@ class LSform { foreach($this -> _rules[$element] as $rule) { $ruleType="LSformRule_".$rule['name']; LSsession :: loadLSclass($ruleType); - if (! call_user_func(array( $ruleType,'validate') , $value, $rule['options'], $this -> getElement($element))) { + if (! call_user_func_array(array( $ruleType,'validate') , array($value, $rule['options'], $this -> getElement($element)))) { $retval=false; $this -> setElementError($this -> elements[$element],$rule['options']['msg']); } diff --git a/public_html/includes/class/class.LSformRule_callable.php b/public_html/includes/class/class.LSformRule_callable.php index ee92655e..5f699c28 100644 --- a/public_html/includes/class/class.LSformRule_callable.php +++ b/public_html/includes/class/class.LSformRule_callable.php @@ -43,7 +43,7 @@ class LSformRule_callable extends LSformRule { */ function validate($value,$option,$formElement) { if (is_callable($option['callable'])) { - return call_user_func($option['callable'],$value,$option,$formElement); + return call_user_func_array($option['callable'],array($value,$option,&$formElement)); } else { LSerror :: addErrorCode('LSformRule_callable_01'); diff --git a/public_html/includes/class/class.LSldapObject.php b/public_html/includes/class/class.LSldapObject.php index 565ed54b..51fd5c79 100644 --- a/public_html/includes/class/class.LSldapObject.php +++ b/public_html/includes/class/class.LSldapObject.php @@ -524,7 +524,7 @@ class LSldapObject { // Validation par fonction externe else if(isset($test['function'])) { if (function_exists($test['function'])) { - if(!call_user_func($test['function'],$this)) { + if(!call_user_func_array($test['function'],array(&$this))) { if ($LSform) $LSform -> setElementError($attr,$msg_error); $retval = false; } @@ -1693,7 +1693,7 @@ class LSldapObject { } foreach($funcs as $func) { if(function_exists($func)) { - if(!call_user_func($func,$this)) { + if(!call_user_func_array($func,array(&$this))) { $return = false; LSerror :: addErrorCode('LSldapObject_07',array('func' => $func,'event' => $event)); } @@ -1713,7 +1713,7 @@ class LSldapObject { $obj = new $e['class'](); if (method_exists($obj,$e['fct'])) { try { - call_user_func(array($obj,$e['fct']),$e['param']); + call_user_func_array(array($obj,$e['fct']),array(&$e['param'])); } catch(Exception $er) { LSerror :: addErrorCode('LSldapObject_10',array('class' => $e['class'],'meth' => $e['fct'],'event' => $event)); @@ -1733,7 +1733,7 @@ class LSldapObject { else { if (function_exists($e['fct'])) { try { - call_user_func($e['fct'],$e['param']); + call_user_func_array($e['fct'],array(&$e['param'])); } catch(Exception $er) { LSerror :: addErrorCode('LSldapObject_27',array('func' => $e['fct'],'event' => $event)); @@ -1753,7 +1753,7 @@ class LSldapObject { foreach ($this -> _objectEvents[$event] as $e) { if (method_exists($e['obj'],$e['meth'])) { try { - call_user_func(array($e['obj'], $e['meth']),$e['param']); + call_user_func_array(array($e['obj'], $e['meth']),array(&$e['param'])); } catch(Exception $er) { LSerror :: addErrorCode('LSldapObject_29',array('meth' => $e['meth'],'event' => $event)); diff --git a/public_html/includes/class/class.LSrelation.php b/public_html/includes/class/class.LSrelation.php index 66a3317b..e9118246 100644 --- a/public_html/includes/class/class.LSrelation.php +++ b/public_html/includes/class/class.LSrelation.php @@ -46,7 +46,7 @@ class LSrelation { $objRel = new $this -> config['LSobject'](); if (isset($this -> config['list_function'])) { if (method_exists($this -> config['LSobject'],$this -> config['list_function'])) { - return call_user_func(array($objRel, $this -> config['list_function']), $this -> obj); + return call_user_func_array(array($objRel, $this -> config['list_function']), array(&$this -> obj)); } LSerror :: addErrorCode('LSrelations_01',array('function' => $this -> config['list_function'], 'action' => _('listing related objects'), 'relation' => $this -> relationName)); return False; @@ -69,7 +69,7 @@ class LSrelation { $objRel = new $this -> config['LSobject'](); if (isset($this -> config['getkeyvalue_function'])) { if (method_exists($this -> config['LSobject'],$this -> config['getkeyvalue_function'])) { - return call_user_func(array($objRel, $this -> config['getkeyvalue_function']), $this -> obj); + return call_user_func_array(array($objRel, $this -> config['getkeyvalue_function']), array(&$this -> obj)); } LSerror :: addErrorCode('LSrelations_01',array('function' => $this -> config['getkeyvalue_function'], 'action' => _('getting key value'), 'relation' => $this -> relationName)); } @@ -115,7 +115,7 @@ class LSrelation { public function removeRelationWithObject($objRel) { if (isset($this -> config['remove_function'])) { if (method_exists($this -> config['LSobject'],$this -> config['remove_function'])) { - return call_user_func(array($objRel, $this -> config['remove_function']),$this -> obj); + return call_user_func_array(array($objRel, $this -> config['remove_function']),array(&$this -> obj)); } LSerror :: addErrorCode('LSrelations_01',array('function' => $this -> config['remove_function'], 'action' => _('deleting'), 'relation' => $this -> relationName)); return False; @@ -132,7 +132,7 @@ class LSrelation { public function renameRelationWithObject($objRel,$oldKeyValue) { if (isset($this -> config['rename_function'])) { if (method_exists($objRel,$this -> config['rename_function'])) { - return call_user_func(array($objRel, $this -> config['rename_function']), $this -> obj, $oldKeyValue); + return call_user_func_array(array($objRel, $this -> config['rename_function']), array(&$this -> obj, $oldKeyValue)); } LSerror :: addErrorCode('LSrelations_01',array('function' => $this -> config['rename_function'], 'action' => _('renaming'), 'relation' => $this -> relationName)); return False; @@ -151,7 +151,7 @@ class LSrelation { $objRel = new $this -> config['LSobject'](); if (isset($this -> config['update_function'])) { if (method_exists($objRel,$this -> config['update_function'])) { - return call_user_func(array($objRel, $this -> config['update_function']), $this -> obj, $listDns); + return call_user_func_array(array($objRel, $this -> config['update_function']), array(&$this -> obj, $listDns)); } LSerror :: addErrorCode('LSrelations_01',array('function' => $this -> config['update_function'], 'action' => _('updating'), 'relation' => $this -> relationName)); }