Jump to content
themixtapechannel

Upgrade from 6.1.5 to 6.2.2 Incomplete

Recommended Posts

On 12/27/2019 at 5:05 AM, KirkM said:

so there are never anything that would trigger a notice or warning unless something is actually wrong with the script execution for whatever reason.  Since I know Al's work is top-notch and wouldn't intentionally throw warnings and notices, my concern is that something is wrong with my server setup or CC installation. 

There will always be hundreds of PHP Notices about undefined indexes as CubeCart is not written to declare variables before use - these can safely be ignored.  There should obviously never be fatal errors and ideally no Warnings either but there always seems to be a few of these kicking around.

The CSRF error is almost always due to the admin directory and the admin.php file being from different versions and havent come across any case caused by anything different 

Share this post


Link to post
Share on other sites

First, I have to apologize for hijacking this thread.  I was just trying to get resolution for the same issue and let it get away from me.  Last thoughts on this PHP discussion and then back to only trying to find solutions to the issue of this thread:

What makes PHP so great is that you can learn more easily because of its built-in tolerance.  I would have quit on day 2 when I started learning the language if I ran into an execution brick wall every time I tried to run a script that wasn't pristine.  I don't think I am alone on that one.  However, I have been accused of being slightly detail-obsessed ("YOU'RE A LUNATIC!"), ahem, so PHP also allows you to get things as refined as you like using the errors display detail in development.  I like this approach even though it may increase my code by a tad here and there but may help me from shooting myself in the foot downstream:

From the PHP Manual:

Quote

 

It is not necessary to initialize variables in PHP however it is a very good practice. Uninitialized variables have a default value of their type depending on the context in which they are used - booleans default to FALSE, integers and floats default to zero, strings (e.g. used in echo) are set as an empty string and arrays to an empty array.

Relying on the default value of an uninitialized variable is problematic in the case of including one file into another which uses the same variable name. ... E_NOTICE level error is issued in case of working with uninitialized variables, however not in the case of appending elements to the uninitialized array. isset() language construct can be used to detect if a variable has been already initialized.

 

From PHP documentation on using empty() as an alternative to isset():

Quote

No warning is generated if the variable does not exist. That means empty() is essentially the concise equivalent to !isset($var) || $var == false.

From stackoverflow community wiki:

Quote

This means that you could use only empty() to determine if the variable is set, and in addition it checks the variable against the following, 0, 0.0, "", "0", null, false or [].

Their recommended solution:

Quote

 

Declare your variables, for example when you try to append a string to an undefined variable. Or use isset() / !empty() to check if they are declared before referencing them, as in:

//Initializing variable
$value = "";  //Initialization value; Examples 
              // ""  When you want to append stuff later 
              // 0 When you want to add numbers later 
              // isset() $value = isset($_POST['value']) ? $_POST['value'] : ''; 
              //empty() $value = !empty($_POST['value']) ? $_POST['value'] : '';

This has become much cleaner as of PHP 7.0, now you can use the null coalesce operator:

// Null coalesce operator - No need to explicitly initialize the variable. 
$value = $_POST['value'] ?? '';

 

Since I have a dedicated server to host my SaaS data management systems, I can use PHP 7.3 and the null coalesce operator in a process or function where a variable may or may not be present and I can satisfy my obsessiveness.  If there is any way I can shoot myself in the foot, I will find it, so it is best for me to try to minimize the chances everywhere I can.  OK, PHP tangent over, back to topic.

Quote

The CSRF error is almost always due to the admin directory and the admin.php file being from different versions and havent come across any case caused by anything different 

This is interesting.  And as I think about it, I am wondering if it is as simple as not changing the obscured admin.php file to the new version code and only uploading the new admin.php file.  I honestly can't remember for sure if I did, but if that is the case, I will be kicking myself.  (REALLY hate that obfuscation approach to the admin) I have done the upgrade so many times and then restore to the old version I can't remember all of the things I tried.  I will give it another go in a bit and see if that is actually the error I am making.

Share this post


Link to post
Share on other sites

A few years back, I had a need to learn Java (a lucrative programming contract - well worth the effort).

After 10 days, I cancelled that contract.

Share this post


Link to post
Share on other sites

OK, so finally got around to attempting the upgrade again and it pretty much worked.  I went back and redid everything with a fine toothed comb.  Not exactly sure what I missed all those other times, but this time it looks like it took.  There are a couple of strange things in the admin interface like on the invoice print page, the button at the top left to go to edit the invoice template is blank.  Also, there is no way to get to the invoice node in the actual documents area even though that is supposedly where it resides.  There is also a blank heading with just parentheses on the store settings->advanced page.  I assume it is supposed to say logs or something like that.  I suspect my language files might be old or something.  Will have to check that out.

image.thumb.png.272fa0256959a129fc3c1782679c83da.png

Share this post


Link to post
Share on other sites

Maybe it is the case that the file /language/definitions.xml did not get upgraded. Maybe it did but CubeCart is getting phrases from somewhere else.

The heading on that table is
Log Retention (Leave empty to disable retention)

And the two missing legends are:
Admin Activity Log
Email Log

Log Retention is a new feature in the CC6.2 series. The phrases are in the <group name="settings"> section of the /language/definitions.xml file.

Editing the Invoice document (the Print icon when viewing an order summary) is via a new tab in admin Documents. The new tab should be labeled "Invoice Editor", but clicking the tab can't happen because the of the way a web browser identifies the tab's target of a block of HTML to display -- by name.

Share this post


Link to post
Share on other sites

Thanks so much for your help.  I did go back and re-upload the language/definitions.xml plus re-added all the language packs with the auto install / upgrade tool and it is all working now.  The auto install is a pretty slick feature.  Really a time saver!  Now on to switching from Authorize.net SIM (depreciated) to Authorize Accept Hosting for the payment gateway with the new CC extension for that. Hopefully, it will be a smooth transition.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...