♥altoid Posted September 8, 2018 Share Posted September 8, 2018 Using the PayPal App in OsC version CE...running php 7.2 in the error log I see the following undefined notice: PHP Notice: Undefined index: osC_Action in /home/MyUsername/public_html/ext/modules/payment/paypal/express.php on line 63 In /ext/modules/payment/paypal/express.php starting on line 63 we find. switch ($HTTP_GET_VARS['osC_Action']) { case 'cancel': tep_session_unregister('appPayPalEcResult'); tep_session_unregister('appPayPalEcSecret'); Any suggestions for a fix for this? I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can. I remember what it was like when I first started with osC. It can be overwhelming. However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc. There are several good pros here on osCommerce. Look around, you'll figure out who they are. Link to comment Share on other sites More sharing options...
♥JcMagpie Posted September 8, 2018 Share Posted September 8, 2018 Its just php 7.2 now classes an undefined verable / array as a scurity risk hence the warning 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. It is also a major security risk with register_globals turned on. 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. Additionally and more ideal is the solution of empty() since it does not generate a warning or error message if the variable is not initialized. Please check with someone else more experianced first before trying on live site. This clears the error in sandbox. if(isset($HTTP_GET_VARS['osC_Action'])) switch ($HTTP_GET_VARS['osC_Action']) { case 'cancel': tep_session_unregister('appPayPalEcResult'); tep_session_unregister('appPayPalEcSecret'); } http://sandbox.onlinephpfunctions.com/code/3b0feba987250aac1cd386e3c12ca2ab396437c2 Link to comment Share on other sites More sharing options...
♥raiwa Posted September 8, 2018 Share Posted September 8, 2018 you should also update $HTTP_GET_VARS to $_GET About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥JcMagpie Posted September 8, 2018 Share Posted September 8, 2018 That is why I said someone with more experiance. 😁 Link to comment Share on other sites More sharing options...
♥altoid Posted September 8, 2018 Author Share Posted September 8, 2018 @raiwa @JcMagpie Thanks for the response. I will look at Zahid's suggestion and see how that goes. Rainer, if you look at commit https://github.com/gburton/Responsive-osCommerce/commit/c0aeb3f2cb86d865e6a04ad9982852c026c4083b You'll see Gary reverted code for some PP App files, apparently so things would work when any updates come out. So there's many of these issues in there that I'm going to let go for now. I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can. I remember what it was like when I first started with osC. It can be overwhelming. However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc. There are several good pros here on osCommerce. Look around, you'll figure out who they are. Link to comment Share on other sites More sharing options...
♥raiwa Posted September 9, 2018 Share Posted September 9, 2018 10 hours ago, altoid said: You'll see Gary reverted code for some PP App files, apparently so things would work when any updates come out. So there's many of these issues in there that I'm going to let go for now. Then for the same reason the above posted notice error fix shouldn't be applied. Anyway a notice error is not important if production error settings are used. About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥altoid Posted September 9, 2018 Author Share Posted September 9, 2018 37 minutes ago, raiwa said: Then for the same reason the above posted notice error fix shouldn't be applied. Anyway a notice error is not important if production error settings are used. I've been thinking about turning off notices, but I've been trying to keep the code as clean as possible thinking as php version update notices could become warnings then fatal errors. Then again as long as my host let's me control the phone version, there you go. I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can. I remember what it was like when I first started with osC. It can be overwhelming. However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc. There are several good pros here on osCommerce. Look around, you'll figure out who they are. Link to comment Share on other sites More sharing options...
a123 Posted September 9, 2018 Share Posted September 9, 2018 @altoidhttps://github.com/osCommerce/oscommerce2/blob/de9e922377cbfd0678c9e4b9e8eb51123f3e230a/catalog/ext/modules/payment/paypal/express.php#L63 change: switch ($HTTP_GET_VARS['osC_Action']) { to: if (isset($HTTP_GET_VARS['osC_Action'])) switch ($HTTP_GET_VARS['osC_Action']) { This is not a big deal. If you dont use ";" at the end of if condition the rule do effect to next enclosed ";" character or next end of following function in PHP Link to comment Share on other sites More sharing options...
♥raiwa Posted September 9, 2018 Share Posted September 9, 2018 @altoid, please read again the previous posts regarding auto update the PayPal App version. If you manually modify the code, it seems you will have trouble when you intend to use the auto update feature for future versions. So you have 2 possibilities: 1. leave the PayPal App as is and accept the notice warnings (there are more still in the CE if you have a look around) and use the recommended production error setting which will not show them. 2. Update the code and keep in mind that it will probably break the auto update feature. (you can keep track on it and revert your changes before trying to run the update to the next version(s) once they will be available). About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥altoid Posted September 9, 2018 Author Share Posted September 9, 2018 7 minutes ago, raiwa said: @altoid, please read again the previous posts regarding auto update the PayPal App version. If you manually modify the code, it seems you will have trouble when you intend to use the auto update feature for future versions. So you have 2 possibilities: 1. leave the PayPal App as is and accept the notice warnings (there are more still in the CE if you have a look around) and use the recommended production error setting which will not show them. 2. Update the code and keep in mind that it will probably break the auto update feature. (you can keep track on it and revert your changes before trying to run the update to the next version(s) once they will be available). Back when I was updating commit by commit towards Edge (at the time) a PP App came along in between and undid many of the changes that Gary and John had done toward 7.2 compatibility. That's when I threw the towel in on trying to keep the App up myself. Then later as noted Gary took steps to keep the PP App capability for updating in CE. Anwya, I'm aware if I modify any PP App related files any further update pushed out by Herald may affect what I've done. I think I'll try fixing this Notice and since that's all I see in the error log for anything PP App file related, I'll let it go from there. I'm hoping if/when Herald does an update any changes would work out for the best. Thanks for the input. I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can. I remember what it was like when I first started with osC. It can be overwhelming. However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc. There are several good pros here on osCommerce. Look around, you'll figure out who they are. Link to comment Share on other sites More sharing options...
a123 Posted September 9, 2018 Share Posted September 9, 2018 44 minutes ago, raiwa said: @altoid, 2. Update the code and keep in mind that it will probably break the auto update feature. (you can keep track on it and revert your changes before trying to run the update to the next version(s) once they will be available). its not true Link to comment Share on other sites More sharing options...
♥raiwa Posted September 9, 2018 Share Posted September 9, 2018 36 minutes ago, tothcom said: its not true sorry, I may be wrong, but can you explain, please. About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
a123 Posted September 9, 2018 Share Posted September 9, 2018 auto update is an unzip method and a simple file overwriting process based on PP app version number.https://github.com/osCommerce/oscommerce2/blob/de9e922377cbfd0678c9e4b9e8eb51123f3e230a/catalog/includes/apps/paypal/admin/actions/update/apply.php The user modified files are not relevant. Only the file changes will be lost. The solution could be to report the problem to App developer but code change is allowed (Released under the GNU General Public License) temporary.https://github.com/osCommerce/oscommerce2/blob/de9e922377cbfd0678c9e4b9e8eb51123f3e230a/catalog/ext/modules/payment/paypal/express.php#L5-L10 If you have a cotract with App developer then this is a relevant request but depends on contract rules. If you dont have prohibition on laws then you can modify codes. I dont know what is the custom on this forum but should respect the app developer authority. On github projects this is working well. Link to comment Share on other sites More sharing options...
♥raiwa Posted September 9, 2018 Share Posted September 9, 2018 If clean file overwrite, why then the update reversion mentioned here: I understand it's because of code (line by line) update, not file overwrite. About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥altoid Posted September 9, 2018 Author Share Posted September 9, 2018 5 hours ago, tothcom said: @altoidhttps://github.com/osCommerce/oscommerce2/blob/de9e922377cbfd0678c9e4b9e8eb51123f3e230a/catalog/ext/modules/payment/paypal/express.php#L63 change: switch ($HTTP_GET_VARS['osC_Action']) { to: if (isset($HTTP_GET_VARS['osC_Action'])) switch ($HTTP_GET_VARS['osC_Action']) { This is not a big deal. If you dont use ";" at the end of if condition the rule do effect to next enclosed ";" character or next end of following function in PHP I tried this change, but in testing, live shop, the checkout process kept looping back after I reached the checkout shipping stage. Like ground hog day. So I reverted to the original and was able to get to the PayPal log in page as usual. Here's the before and after coding copied from Winmerge switch ($HTTP_GET_VARS['osC_Action']) { and....after if (isset($HTTP_GET_VARS['osC_Action'])) switch ($HTTP_GET_VARS['osC_Action']) { As of now, I'm back to the original as noted. I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can. I remember what it was like when I first started with osC. It can be overwhelming. However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc. There are several good pros here on osCommerce. Look around, you'll figure out who they are. Link to comment Share on other sites More sharing options...
♥JcMagpie Posted September 9, 2018 Share Posted September 9, 2018 Yeah I dont think you can just tag that onto the front. It needs to be applied properly depending on the rest of the code. But then I'm not a php experts, sorry. example. Link to comment Share on other sites More sharing options...
♥raiwa Posted September 9, 2018 Share Posted September 9, 2018 If you use it, I would also say it should be wrapped around the switch: if (isset($HTTP_GET_VARS['osC_Action'])) { switch ($HTTP_GET_VARS['osC_Action']) { ... ... ... } //end switch } //end if isset About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
a123 Posted September 9, 2018 Share Posted September 9, 2018 I see @altoid Author pressed it directly in switch statmentshttps://github.com/osCommerce/oscommerce2/blob/de9e922377cbfd0678c9e4b9e8eb51123f3e230a/catalog/ext/modules/payment/paypal/express.php#L706 default branch can not run when you examine $HTTP_GET_VARS['osC_Action'] before I wont give you a solution because you have to totaly revrite the switch-case statement into elseif statements to prevent $_GET exeption. Please report it to the Author to edit switch() to elseif() statement to hide the error notice.https://github.com/haraldpdl/oscom2_app_paypal/issues@JcMagpie have you ever tried coding tool in forum posts? This maybe help a lot Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.