Error 500 syntax error, unexpected 'private' (T_Pr

Hello,

I received this error after receiving a magento2 bad data set error and un-commenting out the  lines

//uncomment below code lines to using for bad data cases only
                                    if (strlen(trim($model2->value)) > 255) {
                                        $model2->value = substr(trim($model2->value), 0, 255);

from Step5Controller.php

 

Error 500

syntax error, unexpected ‘private’ (T_PRIVATE)

How do I go about fixing this??

Thanks

5 answers

Profile photo of Mall Staff 184060.00 $tone January 21, 2020
Public

Hi there,
Let’s provide me fully of the code block you mentioned. I will check further and get back you then.
Regards,
Mall.

#1
Profile photo of Dane Nagy 180.00 $tone January 21, 2020
Public

Hi Mall,
I’m not quite sure what you need.
I received this error message..
Mage2CatalogProductEntityVarchar: Value is too long (maximum is 255 characters).
and found the solution in the questions section on your site here

Mage2CatalogProductEntityVarchar: Value is too lon


So I uncommented out the lines you mention in your answer but then I received the error message
Error 500
syntax error, unexpected ‘private’ (T_PRIVATE).
When I went back and commented those lines again the error went away but then i got the
Mage2CatalogProductEntityVarchar: Value is too long (maximum is 255 characters).
Error message again.

#2
Profile photo of Mall Staff 184060.00 $tone January 21, 2020
Public

Hi there,

So I uncommented out the lines you mention in your answer but then I received the error message
Error 500

It seems you did something wrong. You have to follow additional steps below:

+ Open the PHP file at: pub/ub-tool/protected/controllers/Step5Controller.php
and find the code lines:

//uncomment below code lines to using for bad data cases only
/*if (strlen(trim($model2->value)) > 255) {
$model2->value = substr(trim($model2->value), 0, 255);
}*/

and then, replace it with:

if (strlen(trim($model2->value)) > 255) {
$model2->value = substr(trim($model2->value), 0, 255);
}

Let’s have a look again.

Regards,
Mall.

#3
Profile photo of Dane Nagy 180.00 $tone January 21, 2020
Public

OK so I realized I updated the script while I was in the middle of using the UB migration tool. I reset all steps resaved the file and and restarted the process and everything worked!!
Thanks for your help.
 
 

#4
Profile photo of ubdev Staff 98590.00 $tone January 22, 2020
Public

Hi Dane, 
Yes, please move forward with the migration process at your end. If you have any additional question, feel free to let us know here. 
PS. Since our team is about to have a 7-Days Festival Event starting from Jan 23 to Jan 29, we’re sorry for certain delay in response if you reach out to us during this period. We do have a technical team in charge, however it will take us longer to follow up your questions. Thanks for your understanding.
Regards,
Ubertheme team

#5

Please login or Register to Submit Answer

Written By

Comments