Demitry Posted September 11, 2021 Share Posted September 11, 2021 if ( is_array($color_asked) && count($color_asked) == 3 ) { Or,.... if ( is_countable($color_asked) && count($color_asked) == 3 ) { Hotclutch 1 Quote 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...
Hotclutch Posted September 11, 2021 Author Share Posted September 11, 2021 10 minutes ago, Demitry said: if ( is_array($color_asked) && count($color_asked) == 3 ) { Or,.... if ( is_countable($color_asked) && count($color_asked) == 3 ) { tried both, and they both give: Parse error: syntax error, unexpected '' (T_STRING) Quote Link to comment Share on other sites More sharing options...
Demitry Posted September 11, 2021 Share Posted September 11, 2021 (edited) That's usually an error where there's either an extra single quotation mark, or a missing one. It should not have anything to do with the IF statement. If you are using a code editor, it will usually point to the line that is causing the T_STRING error. Edited September 11, 2021 by Demitry Quote 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...
Hotclutch Posted September 11, 2021 Author Share Posted September 11, 2021 24 minutes ago, Demitry said: That's usually an error where there's either an extra single quotation mark, or a missing one. It should not have anything to do with the IF statement. If you are using a code editor, it will usually point to the line that is causing the T_STRING error. function SetRgbColor($color_asked) { //Returns an array in R,G,B format 0-255 if ($color_asked == "") { $color_asked = array(0,0,0); }; if ( is_countable($color_asked) && count($color_asked) == 3 ) { #if ( count($color_asked) == 3 ) { //already array of 3 rgb $ret_val = $color_asked; } else { // is asking for a color by string if(substr($color_asked,0,1) == "#") { //asking in #FFFFFF format. $ret_val = array(hexdec(substr($color_asked,1,2)), hexdec(substr($color_asked,3,2)), hexdec(substr($color,5,2))); } else { $ret_val = $this->rgb_array[$color_asked]; } } return $ret_val; } Is it working on your side? Quote Link to comment Share on other sites More sharing options...
Demitry Posted September 11, 2021 Share Posted September 11, 2021 (edited) I don't have your version set up and don't use banner manager. I ran into similar count() function errors when migrating to PHP7.3 You should probably use the is_array() function because in the statement just above, the variable is set to an array. Edited September 11, 2021 by Demitry Quote 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...
Hotclutch Posted September 11, 2021 Author Share Posted September 11, 2021 13 minutes ago, Demitry said: I don't have your version set up and don't use banner manager. I ran into similar count() function errors when migrating to PHP7.3 function SetRgbColor($color_asked) { //Returns an array in R,G,B format 0-255 if ($color_asked == "") { $color_asked = array(0,0,0); } if ( is_array($color_asked) ) { if ( count($color_asked) == 3 ) { $ret_val = $color_asked; } } else { // is asking for a color by string if(substr($color_asked,0,1) == "#") { //asking in #FFFFFF format. $ret_val = array(hexdec(substr($color_asked,1,2)), hexdec(substr($color_asked,3,2)), hexdec(substr($color,5,2))); } else { $ret_val = $this->rgb_array[$color_asked]; } } return $ret_val; } This clears the error. Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted September 12, 2021 Author Share Posted September 12, 2021 admin/customers.php, while trying to edit a customer profile. Warning: Undefined variable $entry_zone_id in /admin/customers.php on line 168 if ($entry_zone_id > 0) $entry_state = ''; Quote Link to comment Share on other sites More sharing options...
Demitry Posted September 12, 2021 Share Posted September 12, 2021 It should be defined on line 123 as: $entry_zone_id = $zone_values['zone_id']; Quote 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...
Hotclutch Posted September 12, 2021 Author Share Posted September 12, 2021 yes I have that at line 123. Quote Link to comment Share on other sites More sharing options...
Demitry Posted September 12, 2021 Share Posted September 12, 2021 You can add isset($entry_zone_id) && to line 168 and line 181, as in,... if (isset($entry_zone_id) && $entry_zone_id > 0) That should get rid of the error, but you still need to test the functionality to make sure it works with this change. I'm not sure why it's throwing this error. Hotclutch 1 Quote 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...
Hotclutch Posted September 12, 2021 Author Share Posted September 12, 2021 if i put this on 168: if (isset($entry_zone_id)) { if ($entry_zone_id > 0) $entry_state = ''; } and on 184 if (isset($entry_zone_id)) { if ($entry_zone_id > 0) { $sql_data_array['entry_zone_id'] = $entry_zone_id; $sql_data_array['entry_state'] = ''; } else { $sql_data_array['entry_zone_id'] = '0'; $sql_data_array['entry_state'] = $entry_state; } } } then the errors are cleared. Not sure if its the best way to do it though. Quote Link to comment Share on other sites More sharing options...
Demitry Posted September 12, 2021 Share Posted September 12, 2021 (edited) Right! That is why I said that you have to test the functionality for that state function/feature. All that isset() function does is check to see if the variable was previously set. In other words, if it wasn't set, the instructions that follow in those two IF statements will not execute. Edited September 12, 2021 by Demitry Quote 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...
Hotclutch Posted September 14, 2021 Author Share Posted September 14, 2021 application_top.php if (in_array($_POST['products_id'][$i], (is_array($_POST['cart_delete']) ? $_POST['cart_delete'] : array()))) { Warning: Undefined array key "cart_delete" Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted September 14, 2021 Author Share Posted September 14, 2021 The forks (CEs) code have been modified here in application_top.php, in case anybody wants to check this, but that code also throws the same error. Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted September 14, 2021 Author Share Posted September 14, 2021 Vanilla osCommerce = no errors. Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted September 17, 2021 Author Share Posted September 17, 2021 admin/includes/functions/general.php function tep_get_products_name($product_id, $language_id = 0) { global $languages_id; if ($language_id == 0) $language_id = $languages_id; $product_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'"); $product = tep_db_fetch_array($product_query); return $product['products_name']; } Warning: Trying to access array offset on value of type null function tep_get_products_name($product_id, $language_id = 0) { global $languages_id; if ($language_id == 0) $language_id = $languages_id; $product_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'"); $product = tep_db_fetch_array($product_query); if (isset($product['products_name'])) return $product['products_name']; } This clears the error. Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted September 18, 2021 Author Share Posted September 18, 2021 function tep_get_products_name($product_id, $language_id = 0) { global $languages_id; if ($language_id == 0) $language_id = $languages_id; $product_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'"); $product = tep_db_fetch_array($product_query); return isset($product['products_name']) ? $product['products_name'] : ''; } function tep_get_products_description($product_id, $language_id) { $product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'"); $product = tep_db_fetch_array($product_query); return isset($product['products_description']) ? $product['products_description'] : ''; } Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted September 21, 2021 Author Share Posted September 21, 2021 admin/functions/general.php tep_generate_category_path function there are 2x Warning: Trying to access array offset on value of type null these are the 2 lines that trigger the warnings: $categories_array[$index][] = array('id' => $id, 'text' => $category['categories_name']); if ( (tep_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index); Quote Link to comment Share on other sites More sharing options...
♥Smoky Barnable Posted September 21, 2021 Share Posted September 21, 2021 2 hours ago, Hotclutch said: admin/functions/general.php tep_generate_category_path function there are 2x Warning: Trying to access array offset on value of type null these are the 2 lines that trigger the warnings: $categories_array[$index][] = array('id' => $id, 'text' => $category['categories_name']); if ( (tep_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index); $categories_array[$index][] = array('id' => $categories['categories_id'], 'text' => $category['categories_name']); if ((!empty($category['parent_id'])) && ($category['parent_id'] != '0')) $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index); Quote 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...
Demitry Posted September 22, 2021 Share Posted September 22, 2021 from Zombie Phoenix v1.0.7.3 function tep_generate_category_path($id, $from = 'category', $categories_array = [], $index = 0) { global $languages_id; if ($from == 'product') { $categories_query = tep_db_query("SELECT categories_id FROM products_to_categories WHERE products_id = " . (int)$id); while ($categories = tep_db_fetch_array($categories_query)) { if ($categories['categories_id'] == '0') { $categories_array[$index][] = ['id' => '0', 'text' => TEXT_TOP]; } else { $category_query = tep_db_query("SELECT cd.categories_name, c.parent_id FROM categories c, categories_description cd WHERE c.categories_id = " . (int)$categories['categories_id'] . " AND c.categories_id = cd.categories_id AND cd.language_id = " . (int)$languages_id); $category = tep_db_fetch_array($category_query); $categories_array[$index][] = ['id' => $categories['categories_id'], 'text' => $category['categories_name']]; if ( (tep_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) { $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index); } $categories_array[$index] = array_reverse($categories_array[$index]); } $index++; } } elseif ($from == 'category') { $category_query = tep_db_query("SELECT cd.categories_name, c.parent_id FROM categories c, categories_description cd WHERE c.categories_id = " . (int)$id . " AND c.categories_id = cd.categories_id AND cd.language_id = " . (int)$languages_id); $category = tep_db_fetch_array($category_query); $categories_array[$index][] = ['id' => $id, 'text' => $category['categories_name']]; if ( (tep_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) { $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index); } } return $categories_array; } Quote 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...
Hotclutch Posted September 22, 2021 Author Share Posted September 22, 2021 10 hours ago, Smoky Barnable said: $categories_array[$index][] = array('id' => $categories['categories_id'], 'text' => $category['categories_name']); if ((!empty($category['parent_id'])) && ($category['parent_id'] != '0')) $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index); Here is how to trigger these errors: In Admin go to products_expected.php -> if there are none you won't notice any errors and you will be unaware they exist in the code. Now go set a future available date on one of the products. Go back to products_expected.php, and try to edit from there. You will see the errors. @Smoky Barnable if ((!empty($category['parent_id'])) && ($category['parent_id'] != '0')) $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index); this line of code fixes one of the errors, still leaves the other. $categories_array[$index][] = array('id' => $categories['categories_id'], 'text' => $category['categories_name']); this line of code throws more errors, not sure if you meant to put $categories['categories_id'] or $category['categories_id'] instead. Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted September 30, 2021 Author Share Posted September 30, 2021 Sloppy Words Cleaner throws these errors: To be safe i put isset on all the variables // BOF Sloppy Words Cleaner // note: rem // any below lines that you don't want to clean (or) maybe don't have, you can look at your existing osC input fields, line ~50) $firstname = isset($firstname) ? RemoveShouting($firstname,true) : ''; $lastname = isset($lastname) ? RemoveShoutingLN($lastname,true) : ''; $email_address = isset($email_address) ? strtolower($email_address) : ''; $confirm_email_address = isset($confirm_email_address) ? strtolower($confirm_email_address) : ''; //$company = RemoveShoutingCN($company); $street_address = isset($street_address) ? RemoveShouting($street_address) : ''; $street_address2 = isset($street_address2) ? RemoveShouting($street_address2) : ''; $suburb = isset($suburb) ? RemoveShouting($suburb) : ''; $postcode = isset($postcode) ? strtoupper($postcode) : ''; $city = isset($city) ? RemoveShouting($city) : ''; $state = isset($state) ? RemoveShouting($state) : ''; // EOF Sloppy Words Cleaner Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted September 30, 2021 Author Share Posted September 30, 2021 $wo_full_name = $customer['customers_firstname'] . ' ' . $customer['customers_lastname']; function tep_update_whos_online() { global $customer_id; if (tep_session_is_registered('customer_id')) { $wo_customer_id = $customer_id; $customer_query = tep_db_query("select customers_firstname, customers_lastname from customers where customers_id = '" . (int)$customer_id . "'"); $customer = tep_db_fetch_array($customer_query); $wo_full_name = $customer['customers_firstname'] . ' ' . $customer['customers_lastname']; } else { $wo_customer_id = ''; $wo_full_name = 'Guest'; } Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted September 30, 2021 Author Share Posted September 30, 2021 ignore the whos online error. I created a test account, then deleted the account. Then went back to the catalog to log out. that's probably what generated the error. Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted October 11, 2021 Author Share Posted October 11, 2021 On the products_attributes.php an error pointing to admin/includes/functions/general.php Warning: Trying to access array offset on value of type null function tep_options_name($options_id) { global $languages_id; $options = tep_db_query("select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$options_id . "' and language_id = '" . (int)$languages_id . "'"); $options_values = tep_db_fetch_array($options); return $options_values['products_options_name']; } This clears the error: function tep_options_name($options_id) { global $languages_id; $options = tep_db_query("select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$options_id . "' and language_id = '" . (int)$languages_id . "'"); $options_values = tep_db_fetch_array($options); return $options_values['products_options_name'] ?? ''; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.