Peper Posted June 7, 2018 Share Posted June 7, 2018 Many many updates required for PHP7.2 So far so good - testing everything and eliminating bugs Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
♥John W Posted June 7, 2018 Share Posted June 7, 2018 I had not seen that error before, but a little Googling and reading showed that it's popping up for others with other software. Normally, PHP errors can be found with Google and see how others solve it. My thought was that it was a string that needed to be cast, but i wasn't certain. Most of the OSC code cast variables years ago, but addons don't have it. Anyway, we both learned today and that's always a good thing. I'm not really a dog. Link to comment Share on other sites More sharing options...
♥John W Posted June 7, 2018 Share Posted June 7, 2018 Try this. Did a little searching on StackOverflow and learned a little more. Had to add the Hash class so I could experiment. This yeilds an output now. function tep_random_name() { $letters = 'abcdefghijklmnopqrstuvwxyz'; $dirname = '.'; $length = floor(Hash::getRandomInt(16, 20)); for ($i = 1; $i <= $length; $i++) { $q = floor(Hash::getRandomInt(1, 26)); $dirname .= $letters[(int)$q]; } return $dirname; } I'm not really a dog. Link to comment Share on other sites More sharing options...
♥John W Posted June 7, 2018 Share Posted June 7, 2018 It only works when there's no z in the output. I ran into this on another piece of Harald's code I was playing with. I found a workaround, but it's not a good one and I'm not sure why it even works. Putting a -1 after $q stops errors. function tep_random_name() { $letters = 'abcdefghijklmnopqrstuvwxyz'; $dirname = '.'; $length = floor(Hash::getRandomInt(16, 20)); for ($i = 1; $i <= $length; $i++) { $q = floor(Hash::getRandomInt(1, 26)); $dirname .= $letters[(int)$q-1]; } return $dirname; } I'm not really a dog. Link to comment Share on other sites More sharing options...
♥John W Posted June 7, 2018 Share Posted June 7, 2018 Why not use the PHP builtin has functions? I'm not really a dog. Link to comment Share on other sites More sharing options...
♥John W Posted June 7, 2018 Share Posted June 7, 2018 I was just talking about the hash functions used, but I don't really have an argument for it. http://www.php.net/Hash I just put the function into a test page and the errors went away after the (int) addition, but I was just testing the output of the function. I did get the string offset errors at first. I'm not really a dog. Link to comment Share on other sites More sharing options...
MrPhil Posted June 8, 2018 Share Posted June 8, 2018 There are various functions around (e.g., tempnam, or possibly tmpfile) for creating unique temporary file names. It might be cleaner to use one of them. Also, when generating names, you have two problems: I don't see anything to prevent duplicates (unlikely, but still possible). Depending on who can see these names, some might be offensive. An easy way out of this to to drop the vowels and use only the 20 consonants. Link to comment Share on other sites More sharing options...
BrockleyJohn Posted October 5, 2018 Share Posted October 5, 2018 1 hour ago, Daniel204 said: what about the PHP 7? tried it, liked it 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 More sharing options...
xmanic Posted October 14, 2018 Share Posted October 14, 2018 Hi, I had the same problem with my site after upgrading the server to php 7. After upgraded from php7 all is good. Have a nice day! Link to comment Share on other sites More sharing options...
ArtcoInc Posted December 7, 2018 Share Posted December 7, 2018 (At the risk of reviving an old thread, with a (perhaps) off-topic question ... ) Is there a problem with coding a shop to run under PHP 7.2, and actually running in under PHP 5.6? The reason I ask is that I have several shop on my host's server. As I update each shop, I want to bring each up to be PHP 7.2 ready (even though my host currently only offers up to PHP 7.0), but leave all the shops at PHP 5.6 until all are upgraded. Will and PHP 7.2 specific code cause a problem under PHP 5.6? TIA M Link to comment Share on other sites More sharing options...
BrockleyJohn Posted December 7, 2018 Share Posted December 7, 2018 @ArtcoInc generally speaking, it shouldn't be a problem. There is syntax on 7-7.2 that isn't supported on 5.6 but you're probably not going to be using any of it in your new version... spaceships <=>, null coalescing ($action = $_GET['action'] ?? 'default'), anonymous classes, constant arrays and a bunch of other things that don't spring straight to mind. The only bit of code I can think of that doesn't work across versions is something to do with error-handling on evals but you probably haven't got any of that anyway. The evaluation order in statements is the other way round (eg. when working out what $$class->$method($param[$$key]) means but that should have been fixed by putting in curly braces to make it expllicit in the statement. The approach would be - get a set of code running without issue on 7 and then turn the version back down to 5.6 for a test. hth 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 More sharing options...
cornishpirate Posted December 21, 2018 Author Share Posted December 21, 2018 Just updated my server to run PHP 7.3. Running live site now using it No significant issues at all - just a Deprecated warning in PHPmailer which was easily fixed. Various benchmarks suggest about a 10% speed improvement. Link to comment Share on other sites More sharing options...
osComMarket Posted December 22, 2018 Share Posted December 22, 2018 PP should give warnings around php 7+. No release covered that. Link to comment Share on other sites More sharing options...
Summer88 Posted February 16, 2019 Share Posted February 16, 2019 I am using v2.3.4. I guess I could replace the "boxes" with div based code but it would not change the hierarchy of the classes that caused the error. Link to comment Share on other sites More sharing options...
edoscript Posted September 16, 2019 Share Posted September 16, 2019 On 1/13/2017 at 11:59 AM, dr_lucas said: You can easily fix it. Read this: http://stackoverflow.com/questions/35128323/php-extended-class @dr_lucas I was having the same issue. Thanks for the link. Link to comment Share on other sites More sharing options...
milerwan Posted October 4, 2019 Share Posted October 4, 2019 @BrockleyJohn @ArtcoInc @raiwa Hi, Anyone know how to solve the "undefined method objectInfo" error encountered in admin/catagories.php ? : Fatal error: Uncaught Error: Call to undefined method objectInfo::objectInfo() in D:\wamp\www\admin\categories.php on line 775 Error: Call to undefined method objectInfo::objectInfo() in D:\wamp\www\admin\categories.php on line 775 Here is the class objectInfo : class objectInfo { // class constructor function __construct($object_array) { // reset($object_array); // while (list($key, $value) = each($object_array)) { foreach ($object_array as $key => $value) { $this->$key = tep_db_prepare_input($value); } } } ?> Ok, I have found this fix : https://github.com/gburton/CE-Phoenix/blob/master/admin/includes/classes/object_info.php?fbclid=IwAR0vd1Gx3ArEYkCm7SViCTKqHVlbl21vXmTbookJwjSjNMwf_nJxJ0Zl88s <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class objectInfo { // class constructor function __construct($object_array) { $this->objectInfo($object_array); } function objectInfo($object_array) { foreach($object_array as $key => $value) { $this->$key = tep_db_prepare_input($value); } } } ?> Osc v2.3.4 BS "custom" PHP 7.3 compatible (710 modified files => o_O') Link to comment Share on other sites More sharing options...
BrockleyJohn Posted October 4, 2019 Share Posted October 4, 2019 @milerwan yes, use the version of the class from phoenix, frozen etc which has the proper fix for php7. In this case you don't rename the constructor you add one and call the existing eponymous method because it's called directly. 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 More sharing options...
BrockleyJohn Posted October 4, 2019 Share Posted October 4, 2019 specificially: function __construct($object_array) { $this->objectInfo($object_array); } 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 More sharing options...
milerwan Posted October 4, 2019 Share Posted October 4, 2019 24 minutes ago, BrockleyJohn said: @milerwan yes, use the version of the class from phoenix, frozen etc which has the proper fix for php7. In this case you don't rename the constructor you add one and call the existing eponymous method because it's called directly. @BrockleyJohn Yes, thank you ! I have another issue from "checkout_shipping" page with strange errors. Could you take a look on it, it is reported here : NB: I have just tried to used Phoenix's "checkout_shipping.php" script too but same errors... Thank for your help. Osc v2.3.4 BS "custom" PHP 7.3 compatible (710 modified files => o_O') Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.