Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Serious issues with PHP v4.3.0


dreamscape

Recommended Posts

I am very surprised. So many people have posted their problems here and no one comes back with a solution ???

 

Shahid of bdbazar.com - you had a problem - i now see your cart working alright - how did you solve your problem.

 

I think whoever got it sorted, must also come back and report how they got it sorted!!!!!!!

 

Well I dont have this problem, but still I felt that people should come back and report how they solved their problem.

 

I agree, it would be very helpful if people would post how they got their problem resolved, especially for something that prevents a site from going live or takes a working one down like this PHP 4.3 issue.

 

I can't remember the exact release, but PHP 4.2.x had a session bug.

 

If you're running on 4.2.x, try upgrading to later PHP version.

 

For me it works fine on 4.2.2, but not with 4.3.2.

 

I have tried the suggestions posted in this thread, but still can't get it to work.

 

Any help would be greatly appreciated!!!

Awana Grand Prix and Pinewood Derby racing - Where a child, an adult and a small block of wood combine for a lot of fun and memories.

Link to comment
Share on other sites

  • Replies 65
  • Created
  • Last Reply
For me it works fine on 4.2.2, but not with 4.3.2

 

It would have been clearer if you stated 4.3.2RC4 :D

 

That Release Candidate version of 4.3.2 had a session bug, here for more info:

 

http://bugs.php.net/bug.php?id=23761

 

Solution: Upgrade :D

:heart:, osCommerce

Link to comment
Share on other sites

For me it works fine on 4.2.2, but not with 4.3.2

 

It would have been clearer if you stated 4.3.2RC4 :D

 

That Release Candidate version of 4.3.2 had a session bug, here for more info:

 

http://bugs.php.net/bug.php?id=23761

 

Solution: Upgrade :D

 

Thanks Harald

 

I appreciate your looking into this. Sorry, the RC4 didn't register in my brain. I wish upgrading was that easy. I'm on a shared server, so I would think that my webhost would have to do this, but I have a feeling that they won't be that quick to respond. You would think they would be smart enough not to install a release candidate version.

Awana Grand Prix and Pinewood Derby racing - Where a child, an adult and a small block of wood combine for a lot of fun and memories.

Link to comment
Share on other sites

  • 3 weeks later...

Just to follow up. My ISP upgraded their servers to version 4.3.2, from 4.3.2 RC4, and the problem with the cart emptying out is gone. :D

 

I'm really suprised that they would install a beta version of PHP on their production servers in the first place :x

 

Thanks for your help identifying the problem Harald.

Awana Grand Prix and Pinewood Derby racing - Where a child, an adult and a small block of wood combine for a lot of fun and memories.

Link to comment
Share on other sites

My host is running PHP 4.3.1 and I haven't had a problem with it. But, I'm not sure how long it has been running. My snapshot is 12.21.02

 

But, I am having a problem recently with people being able to checkout with an out of stock item. Could this be related?

I'm not really a dog.

Link to comment
Share on other sites

My host is running PHP 4.3.1 and I haven't had a problem with it. But, I'm not sure how long it has been running. My snapshot is 12.21.02

 

But, I am having a problem recently with people being able to checkout with an out of stock item. Could this be related?

 

I don't believe so. The problem that I was experiencing was related to the cart information in session being lost altogether upon checkout, due to a bug in the version of PHP that my ISP was using.

Awana Grand Prix and Pinewood Derby racing - Where a child, an adult and a small block of wood combine for a lot of fun and memories.

Link to comment
Share on other sites

My host is running PHP 4.3.1 and I haven't had a problem with it. But, I'm not sure how long it has been running. My snapshot is 12.21.02

 

But, I am having a problem recently with people being able to checkout with an out of stock item. Could this be related?

Go into Admin ~ Configuration ~ Stock and set Allow Checkout to False.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

Hi Daemonj,

 

I don't think I was clear, I have had this working for 6 months and it just stopped working. Everything is set correctly but it is now allowing checkout.

 

Any clues?

I'm not really a dog.

Link to comment
Share on other sites

If you are a little familiar with PHP, edit the catalog/shopping_cart.php file and find the portion where the out_of_stock check is performed. Place a few echo statements to check the values of the variables that are being compared. Something has to be returning an incorrect value, if a value at all. Find out what it is and then you will have an idea of how to fix it.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

Thanks for the reply. It seems there are two spots that it looks at contents

 

<?php

 if ($cart->count_contents() > 0) {

?>

 

I think this is where you are talking about. Can you give me an example of what my echo statement should look like and where I will find it's response?

 

I appreciate you help on this.[/code]

I'm not really a dog.

Link to comment
Share on other sites

Make that line of code look like:

<?php

 echo 'The result of $cart->count_contents() is:  ' . $cart->count_contents() . "n";

 if ($cart->count_contents() > 0) { 

?>

and when you display the shopping_cart.php file you should see a printout of the information.

 

If it there is no entry after the 'The result of $cart->count_contents() is: portion, then check the cart class (includes/classes folder) for the count_contents member function and see where it is failing.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

  • 3 weeks later...

My development server is php 4.1.2 and the online server is 4.2.1. I have tried all of the solutions submitted above, except for the .htaccess solution, and the problem persists.

 

On another forum topic, a poster (berzerko) offered an alternative solution which didn't fully work either but did offer a partial solution.

 

The problem I encountered is the the code:

 

$HTTP_GET_VARS = $_GET;

 

doesn't work becuase the two arrays are not the same type. As a result, $HTTP_GET_VARS is an object. The elements indexed by a string become a property of the object. Elements index by numbers remain but are inaccessable. So another solution is needed. Below is the solution that works (so far) for me.

 

'catalog/includes/application_top.php'

 

ln 21

 

/* if (function_exists('ini_get')) {

ini_get('register_globals') or exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!');

}

*/

 

// GKD Mod

// alternate "globals on" code

 

$globalsOffCheck = false;

if (function_exists('ini_get')) {

if(!ini_get('register_globals')){

include('globals_on.php');

$globalsOffCheck = true;

}

 

} else {

exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!');

}

 

// END Mod

 

 

ln 204

 

...

 

} else {

tep_session_start();

$session_started = true;

}

 

// GKD MOD

 

/* convert to globals_off - line 26 starts the process, this continues it

 

This code is located here rather than in 'globals_on.php since session have not beencalled until after the globals_on is called. As a result, no values in _SESSION at the time of calling 'globals_on.php'*/

 

if($globalsOffCheck){

 

if (!empty($_SESSION)) {

extract($_SESSION);

foreach($_SESSION as $key =>$val){

$HTTP_SESSION_VARS[$key] = $val;

}

} else if (!empty($HTTP_SESSION_VARS)) {

extract($HTTP_SESSION_VARS);

}

}

 

// END GKD MOD

 

 

'catalog/includes/globals_on.php'

 

-----------------------------------------------------------------------

// Code to Mimic Globals on:

 

extract($_REQUEST);

 

if (!empty($_SERVER)) {

extract($_SERVER);

foreach($_SERVER as $key =>$val){

$HTTP_SERVER_VARS[$key] = $val;

}

} else if (!empty($HTTP_SERVER_VARS)) {

extract($HTTP_SERVER_VARS);

}

 

 

 

if (!empty($_ENV)) {

extract($_ENV);

foreach($_ENV as $key =>$val){

$HTTP_ENV_VARS[$key] = $val;

}

} else if (!empty($HTTP_ENV_VARS)) {

extract($HTTP_ENV_VARS);

}

 

 

if (!empty($_COOKIE)) {

extract($_COOKIE);

foreach($_COOKIE as $key =>$val){

$HTTP_COOKIE_VARS[$key] = $val;

}

 

} else if (!empty($HTTP_COOKIE_VARS)) {

extract($HTTP_COOKIE_VARS);

}

 

 

if (!empty($_POST)) {

extract($_POST);

foreach($_POST as $key =>$val){

$HTTP_POST_VARS[$key] = $val;

}

} else if (!empty($HTTP_POST_VARS)) {

extract($HTTP_POST_VARS);

}

 

if (!empty($_GET)) {

extract($_GET);

foreach($_GET as $key =>$val){

$HTTP_GET_VARS[$key] = $val;

}

} else if (!empty($HTTP_GET_VARS)) {

extract($HTTP_GET_VARS);

}

 

 

if (!empty($_FILES)) {

extract($_GET);

foreach($_GET as $key =>$val){

$HTTP_POST_FILES[$key] = $val;

}

} else if (!empty($HTTP_POST_FILES)) {

extract($HTTP_POST_FILES);

}

 

 

 

 

/* moved to application_top.php

converting $_SESSION is deferred until the session is started by 'application_top.php' around line 206

 

...

 

tep_session_start();

$session_started = true;

}

 

// GKD MOD

 

if (!empty($_SESSION)) {

extract($_SESSION);

foreach($_SESSION as $key =>$val){

$HTTP_SESSION_VARS[$key] = $val;

}

} else if (!empty($HTTP_SESSION_VARS)) {

extract($HTTP_SESSION_VARS);

}

 

 

// END GKD MOD

 

...

 

*/

 

 

This modication needs to be done for both the catalog and admin sections.

 

 

Essentially, this is a blunt force solution to the problem. Its sole virtue is that it works, at least for me. However, as it is not selective, it may cause conflicts with variables used by some of the mods provided by contributors. The potential for this could be reduced by convertising all of the HTTP_*_VARS code used by the osCommerce programming. This can be done simply, easily and at no cost by the 'search and replace' class to be found at phpguru.org.

 

Finally, I would like to echo a comment of a previous poster. This is an issue that goes to the heart of the long term viability of osCommerce. It is an issue that sould be addressed now by the osCommerce team now, not later. Users who have to go through the nightmare of getting osCommerce operating each time there is an upgrade to php will soon look elsewhere for e-commerce solutions. At the very least, make this issue a separate topic in the forum.

Link to comment
Share on other sites

FATAL ERROR: register_globals is disabled in php.ini, please enable it!

 

 

I knew I should not have ignored this.......

 

Well, three months down the line, I have a store ready for use....but ;)

 

I have been doing all my testing with home-apache server.

 

Here is the problem:

 

I have a web-server I could use that has 500mb of web space, I'really want to use !!

 

BUT...........big one.

 

It's a windows 2000 server, running latest PHP.... Register Globals OFF !!

(No way to turn it on.)

 

Thought I might find an answer here in the forums....

 

I see they (Osc development team) have delayed the fixing of Globals until MS4 !!!!!!.........I read a post written in 2002, that clearly stated that this would be solved by 2.2MS...!??

 

Is this delay deliberate, or is there NOT a solution ?? Can we expect another moving of the goalpost's !! in the future ?

 

Rant...rant...rave...rant !!! (shh behave yourself....see it's driving me mad!)

 

 

 

 

All the current solutions/hacks posted, revolve around the use of .htaccess file......ok if you have an Apache server !! with plenty of admin access.

 

Has anyone got around this problem on a Windows 2000 server + latest PHP????

 

Plz, don't tell me to go and get another host......!

 

Finally, I would like to echo a comment of a previous poster. This is an issue that goes to the heart of the long term viability of osCommerce. It is an issue that sould be addressed now by the osCommerce team now, not later. Users who have to go through the nightmare of getting osCommerce operating each time there is an upgrade to php will soon look elsewhere for e-commerce solutions. At the very least, make this issue a separate topic in the forum.

 

I quite agree, why go to all the effort of producing an excellent PHP shop, that does not follow the standards of php ?

 

 

Has anyone used the solution posted by 'Navarre' posted above ??

Will this work on a Windows server ?

 

Any help or suggestion plz .......

Link to comment
Share on other sites

Hi, I am considering oscommerce and although it looks to have some great features, this subject of register_globals=on is a major Windows hosting problem. Hosts have recognised the php recommendation and are setting it to "off" with the new versions.

Is it possible to get an "official" comment on when, and if, the software will become compatible with register_globals=off?

Link to comment
Share on other sites

  • 3 weeks later...

Hi,

 

I have been following this thread closely. I have had the same problem with PHP and the empty shopping cart. I talked to my System Administrator, and asked him about upgrading to PHP 4.3.2. He is leery to upgrade too quickly as it takes time to work out many of the bugs, and he is not eager to break other customer's shopping carts that may not be nearly as well written as the osC shopping cart.

 

So, he proposed an alternative.....and it works! Well, at least for me, it does. But I thought I would post the resolution here in the hopes of perhaps helping others. Here is what I did:

 

In the Admin/Configuration/Sessions screen, use the following settings:

 

Session Directory /tmp

Force Cookie Use False

Check SSL Session ID False

Check User Agent False

Check IP Address False

Prevent Spider Sessions True

Recreate Session False

 

Suddenly, the shopping cart stopped emptying itself, and I have had no more problems. When my System Admin decides to upgrade in about a month or so after researching PHP 4.3.2, I will change all of the settings back to true and retest, but for now, this works.

 

Hope this helps!

 

Reards,

Karlin

Link to comment
Share on other sites

I have been everywhere (i do believe literally) on the forums looking for a solution to my shopping cart woes. Everytime I think a post is going to do it for me, I try it (or read on in the thread) and find that I'm still experiencing the same problems. Namely, my cart will self empty. Not all the time, just a lot of the time. I can find no rhyme or reason to its emptying.

 

My session variables are already as Karlin had suggested

Session Directory /tmp  

Force Cookie Use False  

Check SSL Session ID False  

Check User Agent False  

Check IP Address False  

Prevent Spider Sessions True  

Recreate Session False

 

I have read all the posts and think maybe its my version of Php, which by the way is run on a shared server (thus no control over release). Can someone please help me so I don't have to go and buy some inferior product.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...