Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

edge, customers not able to create an account


Recommended Posts

41 minutes ago, RAC said:

Line 13 is :

  class shoppingCart {

 

When clicking on the small triangle next to the “13”, it seems to be suggesting there is some text and a closed bracket missing.

😊 That's fine, the triangle just expands the code.

image.png.b2fab717acfc84454ce569a877a342df.png

You should have this on first few lines, I would fix the DB error first and then see what is still showing.

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  class shoppingCart {
    var $contents, $total, $weight;

    function __construct() {
		}

    function shoppingCart() {
      $this->reset();
    }

    function restore_contents() {
      global $customer_id;

      if (!$customer_id) return 0;

 

 

Link to comment
Share on other sites

  • Replies 73
  • Created
  • Last Reply

If your code is from March 2018 then it shouldn't be throwing class constructor warnings - Edge was php7-compatible mid 2017.

However, you may have introduced them when applying addons.

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Hi Zahid.

 

After following your last instructions.

 

There are 23 errors in admin/error_log, the first three are :

 

[03-Nov-2018 11:18:58 Europe/London] PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; logger has a deprecated constructor in ****/admin/includes/classes/logger.php on line 13

[03-Nov-2018 11:18:58 Europe/London] PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; shoppingCart has a deprecated constructor in ****/admin/includes/classes/shopping_cart.php on line 13

[03-Nov-2018 11:18:58 Europe/London] PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; tableBlock has a deprecated constructor in ****/admin/includes/classes/table_block.php on line 13

 

All other errors are different files, 95% of which are line 13.

 

The catalog/error_log has 56 errors :

 

[03-Nov-2018 11:18:59 Europe/London] PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; shoppingCart has a deprecated constructor in /****/includes/classes/shopping_cart.php on line 13

[03-Nov-2018 11:18:59 Europe/London] PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; navigationHistory has a deprecated constructor in /****/includes/classes/navigation_history.php on line 13

[03-Nov-2018 11:18:59 Europe/London] PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; currencies has a deprecated constructor in /****/includes/classes/currencies.php on line 16

 

A majority 60% again are line 13 but there others as well.

 

Will this suffice? or do you need all of the errors?

 

Shaun

Link to comment
Share on other sites

Hi John

Yes as I stated earlier, my installation date seems to be 8th Feb 2018, so my version is a little older than first thought, but I would imagine certainly 2018, so, as you said should be php 7 compatible.

Foolishly I did install an older addon, one that springs to mind is LinuxUK IP trap.

Some months ago,  possibly last year, I installed Linuxuk_ ip trap, after reading a post from an experienced forum member, but then realised a few weeks later it was several years old, so I retraced my steps and uninstalled all of the added files, removed the db entries, then commented out the code added to the existing files.

The above code is boxed by //Start Linuxuk and //end of Linuxuk

However there is still a page in my admin/configuration folder that I have not been able to find the code for!

I am not sure if this could be the problem.

Shaun

 

Link to comment
Share on other sites

1 hour ago, RAC said:

deprecated constructor in

So now you are left with just this one error, I suspect you have a very old version of edge installed. Check the file I listed to see if you have

function __construct() {
		}

 

in it as mine has, this missing is probably the cause of all your errors as

 

In previous versions of PHP, if PHP cannot find a __construct() function for a given class, it will search for the old-style constructor function, by the name of the class, but now old style constructors are DEPRECATED in PHP 7.0, and will be removed in a future version. You should always use __construct() in new code.

http://php.net/manual/en/language.oop5.decon.php

 

Link to comment
Share on other sites

Hi John

Yes as I stated earlier, my installation date seems to be 8th Feb 2018, so my version is a little older than first thought, but I would imagine certainly 2018, so, as you said should be working.

OK Zahid, I have changed the code in classes/shopping_cart.php, and I have created an error_log.txt file in the root, I then changed the code in application_top.php by removing

function __construct() {

After refreshing the page, there was no generated error message, where did I go wrong?

Link to comment
Share on other sites

7 minutes ago, RAC said:

After refreshing the page, there was no generated error message, where did I go wrong? 

I think you are geting confused! I know I am 😊 I did not ask you to remove anything from application_top.php?

As you have the same error in many file you will need to make the same change to each function as you did for shopping_cart.php,

If you look at the link above @bonbec showed you a link to all the files that need this PHP fix.

 

Link to comment
Share on other sites

I would check what errors are still showing in your log, Then fix each file that gives errors. As to rest of the changes, as I don’t know which code version you have your only option is to check and apply each change.

You need to pin down which version you are using then apply all the bug fixes listed for that. Better still update to latest CE version.

 

Link to comment
Share on other sites

Hi Zahid

 

Do I not need to sort these problems out first? or can I just update now?

My Edge version seems to need too many fixes!

Is there a detailed explanation, (for idiots of course)  for the update process.

Obviously I know I will need to install all of my addons, however some of these are already included in the CE version, I think, (hope).

Shaun

Link to comment
Share on other sites

Hello @JcMagpie

All listed files were changed to the __Construct.

I now have an issue with

PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; tableBox has a deprecated constructor in /****Shop/includes/classes/boxes.php on line 13.     Also in the same file on line 75, 100, 132. 148, 165 and 172.

The Admin error log there are 22 errors all relating to deprecated constructor in different classes files :

PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; logger has a deprecated constructor in /****Shop/admin/includes/classes/logger.php on line 13.

Today in Admin so far only one error-
PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP;  actionRecorderAdmin has a deprecated constructor in /admin/includes/classes/action_recorder.php on line 15.
 
Regards
Link to comment
Share on other sites

3 hours ago, RAC said:

Hello @JcMagpie

All listed files were changed to the __Construct.

I now have an issue with

PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; tableBox has a deprecated constructor in /****Shop/includes/classes/boxes.php on line 13.     Also in the same file on line 75, 100, 132. 148, 165 and 172.

The Admin error log there are 22 errors all relating to deprecated constructor in different classes files :

PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; logger has a deprecated constructor in /****Shop/admin/includes/classes/logger.php on line 13.


Today in Admin so far only one error-

PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP;  actionRecorderAdmin has a deprecated constructor in /admin/includes/classes/action_recorder.php on line 15.

 

Regards

That is the same error  you still have issues with fuctions that need __construct adding to them,

example look for any in the files and

Replace

public function ..............

with

public function __construct ...........................

 

Link to comment
Share on other sites

On 11/2/2018 at 1:55 PM, JcMagpie said:

ini_set("log_errors", 1); ini_set("error_log", "error_log.txt"); error_log( "Hello, errors!" );

Hello Zahid @JcMagpie

I have removed the last line as suggested from application_top.php, however I am still getting over 300 of the following errors per day.

[08-Nov-2018 05:10:25 Europe/London] Hello, errors! 

Shaun

 

Link to comment
Share on other sites

Hello again Zahid

 

So if I understand correctly, (not likely, 👀), the errors I am having are still because of some of my files not having the “Function __Construct”?

Therefore the files mentioned in the error logs still need the Function__Construct to replace the Function__***** that is in that file?

Also, if there is more than one function__****** in a file, do they all need replacing?

 

Shaun

Link to comment
Share on other sites

11 hours ago, RAC said:

Hello again Zahid

 

So if I understand correctly, (not likely, 👀), the errors I am having are still because of some of my files not having the “Function __Construct”?

Therefore the files mentioned in the error logs still need the Function__Construct to replace the Function__***** that is in that file?

Also, if there is more than one function__****** in a file, do they all need replacing?

 

Shaun

Careful - don't do exactly what you've said here. Where you see function __something that's a magic method

if you want to know about magic methods and how classes work, you could try this https://www.culttt.com/2014/04/16/php-magic-methods/

but all you really need to know is that there's a special method that gets called when an object of the class is created - it's known as the constructor. In the php4 syntax for classes, the constructor had the same name as the class. From php5 there's the magic method __construct for the constructor but php4 classname methods still work silently as constructors. From php7, the classname methods still get executed when a new object is created but if you have one and no __construct method you get a warning because the php parser is telling you you're running old code on borrowed time that won't behave as expected at some point in the future.

If you don't want to understand or think about any of this and just want a general rule you can always apply for your changes it is this: if you have a class throwing the warning, then it will be like this:

class exampleclass {

  function exampleclass($param1, $param2) {
....

and a change that will always work and behave the same as the old code is this

class exampleclass {

  function __construct($param1,$param2) {
    return $this->exampleclass($param1,$param2);
  }

  function exampleclass($param1,$param2) {
....

by doing them all this way they will all work, but you are making more changes than are actually needed because most of the time you can get away with renaming the function exampleclass to __construct

There are some places where the code behaves differently in php7 than it did in php5 because the order of evaluation of things in a statement is different. I think one of them is in the admin security checks but I don't recall them exactly - you'll need to check through that commit.

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Hello John @BrockleyJohn
 
Thank you, your code worked perfectly, I now have no errors.

 

Hello Zahid @JcMagpie

I am still getting the "Hello,  errors!" message in the error_log.txt file, despite removing the last line of text from your code!!

Any idea how this is happening?

Shaun

 
Link to comment
Share on other sites

Hello Zahid
I have cleared cache but still have Hello errors! Showing!!
My version of edge seems to be July 2017!!!!   I don’t know how I 
managed to download this version in Feb 2018. This is obviously the 
cause of my previous problems.
I have been searching osc for steps in updating to a newer version, but 
there seems to be different opinions on how to do it!
Do you know of a post that shows the correct steps?
Or would it be easier to start from scratch and install CE in a 
different folder, (in public_html alongside my current shop files), 
install all of my addons, import my current database, then????? Change 
configure.php???, (only guessing). Or is this too simplistic, 
(and I am living in a dream world)?
 Shaun
Link to comment
Share on other sites

It's the osC cache you need to clear, find the directory used cor cache and deleat the files in it. If after that its still showing clear your session and check again! Oh and just in case you are like me 😊 check the file again, I have lost count of the number of times I have edited a file and closed it without saving the edit.

 

Link to comment
Share on other sites

1 hour ago, RAC said:

My version of edge seems to be July 2017!!!!   I don’t know how I 
managed to download this version in Feb 2018. This is obviously the 
cause of my previous problems.

 

hate to tell you this Shaun but I believe php7 compliance went into edge in May 2017 so I think it's even older than that

The basic approach, however you set about it, is to do a file compare between your version and CE frozen and make a judgement what to do with each change

you might like to think about hiring a dev to do it for you - it could save you a lot of grief and certainly a lot of time

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...