PDA

View Full Version : Solved PHP Strict Standards: Only variables should be passed by reference



ctrenks
30-05-18, 17:09
Error after upgrading VB to 4.2.5 then latest release of VBET..

PHP Strict Standards: Only variables should be passed by reference in /xxxx/includes/vbenterprisetranslator_class_translator.php on line 410

ctrenks
02-06-18, 21:02
Any thoughts on this error, its re -appearing but not often?

vBET
04-06-18, 12:11
We will investigate it and send you reply soon.

vBET
04-06-18, 12:25
Quick fix for your issue:
1. Open file includes/vbenterprisetranslator_class_translator.php
2. Find

public function translateTextToDivide(&$toTranslate, $serie) {
3. Remove from the line sign '&'
4. Go to 2 (every translator has its own version of this function so you need to remove the sign in several places)

Some explanation - the sign '&' allows to pass value without copying it so it was added for performance reasons.
Since some version of PHP the language forces to pass there only variables (not values count ad hoc when function is called). This is very inconvenient, because we need to change code in many places and create temporary variables only for calling function, but that is how it works now, so we will have to update our code.
We gave you quick fix. We will check how the function is used and decide, is it better to remove '&' or create temporary variables in some places.

ctrenks
04-06-18, 18:44
Thank you, but if performance is an issue, I will allow the error as its a very small occurrence but Thank you for the explanation.

vBET
15-06-18, 22:25
Solution without performance punishment will be included in new release. For quick fix, please:
1. Open file includes/vbenterprisetranslator_class_translator.php
2. Find:

return vbet_translateEncodedText(substr($toTranslate, 0, $point), $this->from, $this->to, $serie, $this)
.$this->translateTextToDivide(substr($toTranslate, $point), $serie);
3. Replace by:

$rest = substr($toTranslate, $point);
return vbet_translateEncodedText(substr($toTranslate, 0, $point), $this->from, $this->to, $serie, $this)
.$this->translateTextToDivide($rest, $serie);
4. Go to 2 (several translators have this code)

AfrikaansAlbanianArabicBelarusianBulgarianCatalanChineseCroatianCzechDanishDutchEnglishEstonianFilipinoFinnishFrenchGalicianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishTaiwaneseThaiTurkishUkrainianVietnameseWelshYiddish
Thanks to vBET 4.9.2 you can enjoy automatic translations