PHP Unknown: Function create_function() is deprecated in /var/www/storage/vendor/braintree/braintree_php/lib/Braintree/Util.php on line 205
PHP Unknown: Function create_function() is deprecated in /var/www/storage/vendor/braintree/braintree_php/lib/Braintree/Util.php on line 172
I see many post here but their resolutions seems to be to downgrade PHP. Has anyone gotten this to work on PHP 7.2?
find:
Code: Select all
$callback = create_function('$matches', 'return strtoupper($matches[1]);');
Code: Select all
$callback[$delimiter] = function($matches) use ($delimiter) {
return $delimiter . strtolower($matches[1]);
};
Code: Select all
$callbacks[$delimiter] = create_function('$matches', "return '$delimiter' . strtolower(\$matches[1]);");
Code: Select all
$callbacks[$delimiter] = function($matches) use ($delimiter) {
return $delimiter . strtolower($matches[1]);
};
find:
Code: Select all
$codes = array_map(create_function('$validationError', 'return $validationError->code;'), $validationErrors);
Code: Select all
$codes = function ($validationErrors) {
return strtolower($validationErrors[1]);
};
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I re-installed.
I performed the above steps.
I refreshed the Extensions>Modifications Refresh
I Refreshed the Dashboard Theme and SaSS
Now I get error when going to edit setting of PayPal powered by Braintree in the Extensions Menu.
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /var/www/opencart/upload/system/storage/vendor/braintree/braintree_php/lib/Braintree/Util.php on line 186
Here is that area of the file...
// so use a static variable to avoid adding a new function to memory
// every time this function is called.
static $callback = null;
if ($callback === null) {
$callback[$delimiter] = function($matches) use ($delimiter) {
return $delimiter . strtolower($matches[1]);
};
return preg_replace_callback('/' . $delimiter . '(\w)/', $callback, $string);
}
/**
* convert alpha-beta-gamma to alpha_beta_gamma
*
* @access public
* @param string $string
* @return string modified string
*/
public static function delimiterToUnderscore($string)
{
return preg_replace('/-/', '_', $string);
}
Code: Select all
return $delimiter . strtolower($matches[1]);
};
Code: Select all
}
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Parse error: syntax error, unexpected 'return' (T_RETURN), expecting function (T_FUNCTION) or const (T_CONST) in /var/www/opencart/upload/system/storage/vendor/braintree/braintree_php/lib/Braintree/Util.php on line 214
Looks like similar issue but I am not seeing anything missing?
Here is my current code:
if (!isset($callbacks[$delimiter])) {
return $delimiter . strtolower($matches[1]);
}
$callbacks[$delimiter] = function($matches) use ($delimiter) {
return $delimiter . strtolower($matches[1]);
};
}
return preg_replace_callback('/([A-Z])/', $callbacks[$delimiter], $string);
}
public static function delimiterToCamelCaseArray($array, $delimiter = '[\-\_]')
{
$c
Original
Code: Select all
$callbacks[$delimiter] = create_function('$matches', "return '$delimiter' . strtolower(\$matches[1]);");
}
return preg_replace_callback('/([A-Z])/', $callbacks[$delimiter], $string);
}
Current
Code: Select all
$callbacks[$delimiter] = function($matches) use ($delimiter) {
return $delimiter . strtolower($matches[1]);
};
}
return preg_replace_callback('/([A-Z])/', $callbacks[$delimiter], $string);
}
Code: Select all
if (!isset($callbacks[$delimiter])) {
return $delimiter . strtolower($matches[1]);
}
$callbacks[$delimiter] = function($matches) use ($delimiter) {
return $delimiter . strtolower($matches[1]);
};
}
Code: Select all
if (!isset($callbacks[$delimiter])) {
$callbacks[$delimiter] = function($matches) use ($delimiter) {
return $delimiter . strtolower($matches[1]);
};
}
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Warning: preg_replace_callback(): Requires argument 2, 'Array', to be a valid callback in /var/www/opencart/upload/system/storage/vendor/braintree/braintree_php/lib/Braintree/Util.php on line 177Warning: preg_replace_callback(): Requires argument 2, 'Array', to be a valid callback in /var/www/opencart/upload/system/storage/vendor/braintree/braintree_php/lib/Braintree/Util.php on line 177
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
The best way is to make the comparison on your FTP between your extracted ZIP file and your system/storage/vendor/Braintree folder. Once you see both sides with identical readings, then you know you're on the right location to extract your files from your host console's file manager by uploading the ZIP file and use the extract button on the same folder location. The extract button will replace the old files in seconds instead of waiting a long time for the upload from FTP to complete.BajaMod wrote: ↑Fri Feb 22, 2019 6:14 amThanks for your help with this. I am surprised how old the code is in OpenCart 3.0.3.1. This code that you are telling me to use is several versions old also. Before I go down this path I want to make sure you want me to use 3.26.0 that you sent in the link. The GitHub doesn't really explain how to install this in OpenCart. Should I just replace all of the files from GitHub into the appropriate folder in OpenCart? Or should I only replace the Util.php? Test.php?
Once the files replaced, clear your OC cache: viewtopic.php?f=176&p=739789#p718325 and try a transaction again with Braintree (Site Maintenance set to 'On' recommended if your site is running in production).
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Users browsing this forum: Ahrefs [Bot] and 23 guests