Teaman55 Posted March 5, 2021 Share Posted March 5, 2021 PHP 8.0 requires that any classes that use the class name as a function name for the constructor function be changed to use __construct() instead. This is an issue for the class boxes.php where the constructors may also be called directly from other classes. Has anyone worked out a solution for this class? Link to comment Share on other sites More sharing options...
♥raiwa Posted March 5, 2021 Share Posted March 5, 2021 This was already required for PHP 7.0 Or am I wrong? 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...
Teaman55 Posted March 26, 2021 Author Share Posted March 26, 2021 Thanks for the response. 7.x announced that using matching function names as constructors would be removed as of 8.0. They still work in 7.x versions as is. class tableBox { var $table_border = '2px solid #ccc;'; var $table_width = '100%'; var $table_cellspacing = '0'; var $table_cellpadding = '0'; var $table_parameters = ''; var $table_row_parameters = 'style="vertical-align: middle;"'; var $table_data_parameters = ''; var $table_top_space = ''; // added AF 22APR05 // class constructor function tableBox($contents, $direct_output = false) { $tableBox_string = '<table style="border: ' . tep_output_string($this->table_border) . ' width: ' . tep_output_string($this->table_width) . '; border-spacing: ' . tep_output_string($this->table_cellspacing) . '; padding: ' . tep_output_string($this->table_cellpadding) . ';"'; if (tep_not_null($this->table_parameters)) $tableBox_string .= ' ' . $this->table_parameters; $tableBox_string .= '>' . "\n"; etc. Every extension of tableBox in boxes.php calls $this->tableBox(). So if it is really the constructor also, as marked in the code above, seems like every version 2.x.x, and probably some later versions, are headed for a breakdown when PHP is upgraded to 8.0. I haven't figured out why boxes.php is built like this, unless it is just to create all the extensions on startup.. In every other class, the matching function name could be changed to __construct without a problem. Can't believe I'm the first person to notice this problem. Link to comment Share on other sites More sharing options...
♥Smoky Barnable Posted July 10, 2021 Share Posted July 10, 2021 I ran into this issue today while updating to PHP 8. Did you ever find a solution? The water in a vessel is sparkling; the water in the sea is dark. The small truth has words which are clear; the great truth has great silence. - Rabindranath Tagore Link to comment Share on other sites More sharing options...
Hotclutch Posted July 10, 2021 Share Posted July 10, 2021 class tableBox { var $table_border = '0'; var $table_width = '100%'; var $table_cellspacing = '0'; var $table_cellpadding = '2'; var $table_parameters = ''; var $table_row_parameters = ''; var $table_data_parameters = ''; // class constructor function __construct($contents, $direct_output = false) { Link to comment Share on other sites More sharing options...
Demitry Posted July 10, 2021 Share Posted July 10, 2021 My osC version does not have this boxes.php class file. However, I believe you have to make that function __construct change to each of the class XXXXX extends tableBox, function XXXXX in that file. osCommerce: made for programmers, ...because store owners do not want to be programmers. https://trends.google.com/trends/explore?date=all&geo=US&q=oscommerce Link to comment Share on other sites More sharing options...
ruden Posted July 11, 2021 Share Posted July 11, 2021 @Smoky Barnable take a look at this commit https://github.com/ruden/vanilla-oscommerce/commit/d4cdd7ca167492f5b1bbcaa08c3de858dc89fd20 Vanilla osCommerce this fork osCommerce v2.3.5 Download | Demo | Support Link to comment Share on other sites More sharing options...
♥Smoky Barnable Posted July 11, 2021 Share Posted July 11, 2021 13 hours ago, ruden said: @Smoky Barnable take a look at this commit https://github.com/ruden/vanilla-oscommerce/commit/d4cdd7ca167492f5b1bbcaa08c3de858dc89fd20 I have been using your vanilla code as a guide to update my shop to PHP 8. It has been very helpful but I see you have removed the boxes. I would like to keep them. Might you have a includes/classes/boxes.php file that is PHP 8 compatible so I can compare with my file? The water in a vessel is sparkling; the water in the sea is dark. The small truth has words which are clear; the great truth has great silence. - Rabindranath Tagore Link to comment Share on other sites More sharing options...
ruden Posted July 12, 2021 Share Posted July 12, 2021 add empty constructor for classes function __construct() { // empty } Vanilla osCommerce this fork osCommerce v2.3.5 Download | Demo | Support Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.