Zen Cart Logo
Forums / Bug Reports / PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

Views: 17,166

Results 1 to 15 of 15
26 Feb 2019, 03:51
#1
e_standard avatar

e_standard

New Zenner

Join Date:
Nov 2013
Location:
China
Posts:
75
Plugin Contributions:
0

PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

ZC 1.5.6a not working with PHP 7.2, it will cause may PHP errors, When i change back to PHP 7.1, everything seems working good.

[20-Feb-2019 16:03:52 UTC] Request URI: /index.php?main_page=product_info&products_id=229643, IP address: 207.46.13.229
#1 require(/home/estand/public_html/includes/init_includes/init_sessions.php) called at [/home/estand/public_html/includes/autoload_func.php:48]
#2 require(/home/estand/public_html/includes/autoload_func.php) called at [/home/estand/public_html/includes/application_top.php:170]
#3 require(/home/estand/public_html/includes/application_top.php) called at [/home/estand/public_html/index.php:26]
--> PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS - assumed 'OFFICE_IP_TO_HOST_ADDRESS' (this will throw an Error in a future version of PHP) in /home/estand/public_html/includes/init_includes/init_sessions.php on line 112.

26 Feb 2019, 12:51
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

Not that there isn't likely something that should still be done to provide a define for that constant, but could you please explain why in configuration->sessions the default of checking for the ip to host conversion has been modified from true to false.

27 Feb 2019, 11:24
#3
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

Be sure your copy of includes/languages/YOUR_TEMPLATE/english.php has

require_once(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . $template_dir_select . FILENAME_EMAIL_EXTRAS);

04 Jan 2020, 12:32
#4
welshop_com avatar

welshop_com

Zen Follower

Join Date:
Aug 2004
Location:
Newport, Wales
Posts:
262
Plugin Contributions:
0

Re: PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

Hi!

I'm getting the same type of error whenever there is a sendmail event - running a new install of 1.5.6c and PHP 7.2.

PHP Warning: Use of undefined constant EMAIL_LOGO_FILENAME - assumed 'EMAIL_LOGO_FILENAME' (this will throw an Error in a future version of PHP) in /home/*****/public_html/includes/functions/functions_email.php on line 494.

I checked and my English.php file does not contain the code mentioned by swguy and its not in the original English.php file either.

Cheers
Brinley

04 Jan 2020, 12:50
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

That file (/includes/languages/english/[YOURTEMPLATE/]email_extras.php) *should *be loaded from the as-shipped zc156a /includes/languages/english.php file, starting at line 628:

///////////////////////////////////////////////////////////
// include email extras
  if (file_exists(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . $template_dir . '/' . FILENAME_EMAIL_EXTRAS)) {
    $template_dir_select = $template_dir . '/';
  } else {
    $template_dir_select = '';
  }
  require_once(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . $template_dir_select . FILENAME_EMAIL_EXTRAS);

Noting that the second constant (EMAIL_LOGO_FILENAME) is also defined in that file.

04 Jan 2020, 13:29
#6
welshop_com avatar

welshop_com

Zen Follower

Join Date:
Aug 2004
Location:
Newport, Wales
Posts:
262
Plugin Contributions:
0

Re: PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

Hi Lat9

I am on 1.5.6 c and the out of the box english.php has this code on line 633 (as does my amended version)

///////////////////////////////////////////////////////////

  $file_list = array(FILENAME_EMAIL_EXTRAS, FILENAME_HEADER, FILENAME_BUTTON_NAMES, FILENAME_ICON_NAMES, FILENAME_OTHER_IMAGES_NAMES, FILENAME_CREDIT_CARDS, FILENAME_WHOS_ONLINE, FILENAME_META_TAGS);
  foreach ($file_list as $file) {
    $file = str_replace(".php","",$file);
    require_once(zen_get_file_directory(DIR_FS_CATALOG . DIR_WS_LANGUAGES . $_SESSION['language'] . '/', $file . '.php', 'false'));
  }

// END OF EXTERNAL LANGUAGE LINKS

I assume I need to add EMAIL_LOGO_FILENAME to this.

Cheers
Brinley

04 Jan 2020, 13:32
#7
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

welshop.com:

Hi Lat9

I am on 1.5.6 c and the out of the box english.php has this code on line 633 (as does my amended version)

///////////////////////////////////////////////////////////

$file_list = array(FILENAME_EMAIL_EXTRAS, FILENAME_HEADER, FILENAME_BUTTON_NAMES, FILENAME_ICON_NAMES, FILENAME_OTHER_IMAGES_NAMES, FILENAME_CREDIT_CARDS, FILENAME_WHOS_ONLINE, FILENAME_META_TAGS);
foreach ($file_list as $file) {
$file = str_replace(".php","",$file);
require_once(zen_get_file_directory(DIR_FS_CATALOG . DIR_WS_LANGUAGES . $_SESSION['language'] . '/', $file . '.php', 'false'));
}

// END OF EXTERNAL LANGUAGE LINKS

> 
> I assume I need to add EMAIL_LOGO_FILENAME to this.
> 
> Cheers
> Brinley
Brinley, you need to check your (template's?) version of /includes/languages/english/email_extras.php.  That's the file that those constants (including the EMAIL_LOGO_FILENAME) are/should be defined.
04 Jan 2020, 14:20
#8
welshop_com avatar

welshop_com

Zen Follower

Join Date:
Aug 2004
Location:
Newport, Wales
Posts:
262
Plugin Contributions:
0

Re: PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

Just checked and I only have the original email_extras.php and english.php files as I have not made copies for my template folder within /includes/languages.

If I do a search for using the Developer toolkit in admin the only result I get when I enter EMAIL_LOGO_FILENAME is:

/home/*****/public_html/includes/functions/functions_email.php

Line #494 :         $block['EMAIL_LOGO_FILE'] = $domain . DIR_WS_CATALOG . 'email/' . EMAIL_LOGO_FILENAME;

Cheers
Brinley

04 Jan 2020, 16:07
#9
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

welshop.com:

Just checked and I only have the original email_extras.php and english.php files as I have not made copies for my template folder within /includes/languages.

If I do a search for using the Developer toolkit in admin the only result I get when I enter EMAIL_LOGO_FILENAME is:

/home/*****/public_html/includes/functions/functions_email.php

Line #494 : $block['EMAIL_LOGO_FILE'] = $domain . DIR_WS_CATALOG . 'email/' . EMAIL_LOGO_FILENAME;

> 
> Cheers
> Brinley
Which means that your includes/languages/english/email_extras.php file was not "upgraded" to include the define(s) expected to be present. The default install of that file includes EMAIL_LOGO_FILENAME as a define.
04 Jan 2020, 16:35
#10
welshop_com avatar

welshop_com

Zen Follower

Join Date:
Aug 2004
Location:
Newport, Wales
Posts:
262
Plugin Contributions:
0

Re: PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

Hi Lat9

Thanks - I'll check my file against the original as I have obviously deleted something I shouldn't have.

Cheers
Brinley

05 Jan 2020, 13:31
#11
welshop_com avatar

welshop_com

Zen Follower

Join Date:
Aug 2004
Location:
Newport, Wales
Posts:
262
Plugin Contributions:
0

Re: PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

Hi Lat9

Thank you for your help - turns out I had removed the EMAIL_LOGO_FILENAME section in the email_extras.php because I hard coded the logo link in my email templates not realising it was function critical. One of the drawback of not understanding php unfortunately - so my bad.

Thanks once again for your assistance - much appreciated.

Cheers
Brinley

07 Jan 2020, 15:10
#12
welshop_com avatar

welshop_com

Zen Follower

Join Date:
Aug 2004
Location:
Newport, Wales
Posts:
262
Plugin Contributions:
0

Re: PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

Spoke too soon - Still getting the following errors

ZenCart version: 1.5.6c - PHP 7.2 - Square Payment module

[07-Jan-2020 12:46:44 Europe/London] Request URI: /****/orders.php?oID=12105&action=update_order, IP address: 910.198.106.185
#1 zen_build_html_email_from_template() called at [/home/CpanelID/public_html/includes/functions/functions_email.php:108]
#2 zen_mail() called at [/home/CpanelID/public_html/includes/functions/functions_osh_update.php:141]
#3 zen_update_orders_history() called at [/home/CpanelID/public_html/exampleadmin/orders.php:158]
--> PHP Warning: Use of undefined constant EMAIL_LOGO_FILENAME - assumed 'EMAIL_LOGO_FILENAME' (this will throw an Error in a future version of PHP) in /home/CpanelID/public_html/includes/functions/functions_email.php on line 494.

[07-Jan-2020 12:46:44 Europe/London] Request URI: /exampleadmin/orders.php?oID=12105&action=update_order, IP address: 910.198.106.185
#1 zen_build_html_email_from_template() called at [/home/CpanelID/public_html/includes/functions/functions_email.php:108]
#2 zen_mail() called at [/home/CpanelID/public_html/includes/functions/functions_osh_update.php:141]
#3 zen_update_orders_history() called at [/home/CpanelID/public_html/exampleadmin/orders.php:158]
--> PHP Warning: Use of undefined constant EMAIL_LOGO_ALT_TITLE_TEXT - assumed 'EMAIL_LOGO_ALT_TITLE_TEXT' (this will throw an Error in a future version of PHP) in /home/CpanelID/public_html/includes/functions/functions_email.php on line 496.

[07-Jan-2020 12:46:44 Europe/London] Request URI: /exampleadmin/orders.php?oID=12105&action=update_order, IP address: 910.198.106.185
#1 zen_build_html_email_from_template() called at [/home/CpanelID/public_html/includes/functions/functions_email.php:108]
#2 zen_mail() called at [/home/CpanelID/public_html/includes/functions/functions_osh_update.php:141]
#3 zen_update_orders_history() called at [/home/CpanelID/public_html/exampleadmin/orders.php:158]
--> PHP Warning: Use of undefined constant EMAIL_LOGO_WIDTH - assumed 'EMAIL_LOGO_WIDTH' (this will throw an Error in a future version of PHP) in /home/CpanelID/public_html/includes/functions/functions_email.php on line 497.

[07-Jan-2020 12:46:44 Europe/London] Request URI: /exampleadmin/orders.php?oID=12105&action=update_order, IP address: 910.198.106.185
#1 zen_build_html_email_from_template() called at [/home/CpanelID/public_html/includes/functions/functions_email.php:108]
#2 zen_mail() called at [/home/CpanelID/public_html/includes/functions/functions_osh_update.php:141]
#3 zen_update_orders_history() called at [/home/CpanelID/public_html/exampleadmin/orders.php:158]
--> PHP Warning: Use of undefined constant EMAIL_LOGO_HEIGHT - assumed 'EMAIL_LOGO_HEIGHT' (this will throw an Error in a future version of PHP) in /home/CpanelID/public_html/includes/functions/functions_email.php on line 498.

[07-Jan-2020 12:46:44 Europe/London] Request URI: /exampleadmin/orders.php?oID=12105&action=update_order, IP address: 910.198.106.185
#1 zen_build_html_email_from_template() called at [/home/CpanelID/public_html/includes/functions/functions_email.php:108]
#2 zen_mail() called at [/home/CpanelID/public_html/includes/functions/functions_osh_update.php:161]
#3 zen_update_orders_history() called at [/home/CpanelID/public_html/exampleadmin/orders.php:158]
--> PHP Warning: Use of undefined constant EMAIL_LOGO_FILENAME - assumed 'EMAIL_LOGO_FILENAME' (this will throw an Error in a future version of PHP) in /home/CpanelID/public_html/includes/functions/functions_email.php on line 494.

[07-Jan-2020 12:46:44 Europe/London] Request URI: /exampleadmin/orders.php?oID=12105&action=update_order, IP address: 910.198.106.185
#1 zen_build_html_email_from_template() called at [/home/CpanelID/public_html/includes/functions/functions_email.php:108]
#2 zen_mail() called at [/home/CpanelID/public_html/includes/functions/functions_osh_update.php:161]
#3 zen_update_orders_history() called at [/home/CpanelID/public_html/exampleadmin/orders.php:158]
--> PHP Warning: Use of undefined constant EMAIL_LOGO_ALT_TITLE_TEXT - assumed 'EMAIL_LOGO_ALT_TITLE_TEXT' (this will throw an Error in a future version of PHP) in /home/CpanelID/public_html/includes/functions/functions_email.php on line 496.

[07-Jan-2020 12:46:44 Europe/London] Request URI: /exampleadmin/orders.php?oID=12105&action=update_order, IP address: 910.198.106.185
#1 zen_build_html_email_from_template() called at [/home/CpanelID/public_html/includes/functions/functions_email.php:108]
#2 zen_mail() called at [/home/CpanelID/public_html/includes/functions/functions_osh_update.php:161]
#3 zen_update_orders_history() called at [/home/CpanelID/public_html/exampleadmin/orders.php:158]
--> PHP Warning: Use of undefined constant EMAIL_LOGO_WIDTH - assumed 'EMAIL_LOGO_WIDTH' (this will throw an Error in a future version of PHP) in /home/CpanelID/public_html/includes/functions/functions_email.php on line 497.

[07-Jan-2020 12:46:44 Europe/London] Request URI: /exampleadmin/orders.php?oID=12105&action=update_order, IP address: 910.198.106.185
#1 zen_build_html_email_from_template() called at [/home/CpanelID/public_html/includes/functions/functions_email.php:108]
#2 zen_mail() called at [/home/CpanelID/public_html/includes/functions/functions_osh_update.php:161]
#3 zen_update_orders_history() called at [/home/CpanelID/public_html/exampleadmin/orders.php:158]
--> PHP Warning: Use of undefined constant EMAIL_LOGO_HEIGHT - assumed 'EMAIL_LOGO_HEIGHT' (this will throw an Error in a future version of PHP) in /home/CpanelID/public_html/includes/functions/functions_email.php on line 498.
 
 

email_extras.php contains the following code

define ('EMAIL_LOGO_FILENAME', 'logo.png');  //-File is present in /email folder
define ('EMAIL_LOGO_WIDTH', '351');
define ('EMAIL_LOGO_HEIGHT', '91');
define ('EMAIL_LOGO_ALT_TITLE_TEXT', 'Brinley Williams Ltd');

functions_email.php, functions_osh_update.php and admin/orders.php are all the same as the files originally downloaded.

any help would be appreciated.

Cheers
Brinley

07 Jan 2020, 15:44
#13
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

Brinley, there's also an admin version of that language file (/admin/includes/languages/english/email_extras.php). Make sure that you've updated that file as well.

07 Jan 2020, 18:12
#14
welshop_com avatar

welshop_com

Zen Follower

Join Date:
Aug 2004
Location:
Newport, Wales
Posts:
262
Plugin Contributions:
0

Re: PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

Duw duw! I didnt know that - thx Lat9, ur a very knowledgeable star.

07 Jan 2020, 19:21
#15
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: PHP Warning: Use of undefined constant OFFICE_IP_TO_HOST_ADDRESS

welshop.com:

Duw duw! I didnt know that - thx Lat9, ur a very knowledgeable star.
Thanks for the compliment, Britney.:smile: I've always thought that that file should be common between the admin and storefront (so you don't have to do multiple, identical changes).