PHP Deprecated: Function strftime() is deprecated mixed text and date time ?
PHP 8.1
$current_method_title = shipping %a (%d %b from %H:%M) // this is from settings in my admin.
PHP Code:
// Add any information specified about a shipping date/time
if (!is_null($method_instance['timestamp'])) {
$current_method_title = strftime($current_method_title,
$method_instance['timestamp']);
} else{ something}
with the above I'm getting PHP Deprecated: Function strftime() is deprecated and I can only ether fix it to display only the text element or fix the date time element but then don't get text and date time how do I fix this please?
Re: PHP Deprecated: Function strftime() is deprecated mixed text and date time ?
If you post back the entire log (making sure to xxx-out your secret Zen Cart admin name), at least we'd be able to point you in a direction. What you've posted is not "core" Zen Cart code, but a plugin or site-specific customization.
Re: PHP Deprecated: Function strftime() is deprecated mixed text and date time ?
yes it is a addon so it is not core.
Code:
[16-Feb-2024 14:14:30 UTC] Request URI: /index.php?main_page=shopping_cart, IP address: 82.132.212.107
#0 /includes/modules/shipping/advshipper.php(5099): zen_debug_error_handler()
#1 /includes/modules/shipping/advshipper.php(457): advshipper->_buildQuotes()
#2 /includes/classes/shipping.php(201): advshipper->quote()
#3 /includes/modules/shipping_estimator.php(151): shipping->quote()
#4 /includes/templates/OJ/templates/tpl_shopping_cart_default.php(188): require('/home/1180590.c...')
#5 /includes/templates/OJ/common/tpl_main_page.php(143): require('/home/1180590.c...')
#6 /index.php(94): require('/home/1180590.c...')
--> PHP Deprecated: Function strftime() is deprecated in /includes/modules/shipping/advshipper.php on line 5099.
but really this is just about dealing with strftime() when dynamic date time are within a string of text.
Re: PHP Deprecated: Function strftime() is deprecated mixed text and date time ?
That's coming from a commercial plugin (Advanced Shipper). I suggest you contact whomever you got that plugin from for the correction.
Re: PHP Deprecated: Function strftime() is deprecated mixed text and date time ?
OK, so Zen Cart has not done what all the other PHP systems have done and created a built-in solution other then dealing with them separately.
Re: PHP Deprecated: Function strftime() is deprecated mixed text and date time ?
Change
PHP Code:
$current_method_title = strftime($current_method_title, $method_instance['timestamp']);
to
PHP Code:
$current_method_title = $zcDate->output($current_method_title, $method_instance['timestamp']);
Re: PHP Deprecated: Function strftime() is deprecated mixed text and date time ?
Thank you for this, I had tried it, but just tried it again and this just fixes/deals with the date time but not text so displays nothing where I need it to fix the date time and also allow for the text to display. which is really what strftime coped with,
I have sort of got it working with date() but not fully:
Code:
// Add any information specified about a shipping date/time if (!is_null($method_instance['timestamp'])) {
$current_method_title = date($current_method_title,
$method_instance['timestamp']);
// Use earliest timestamp from all methods in combination as the timestamp
// for the overall combination
if (is_null($shipping_ts)) {
$shipping_ts = $method_instance['timestamp'];
} else if ($method_instance['timestamp'] < $shipping_ts) {
$shipping_ts = $method_instance['timestamp'];
}
and I get this output:
Quote:
Shipping (CMonday002024-02-26T09:00:35+00:00k & C2024MondayMondayUTC2024-02-26T09:00:35+00:0029 +00:00Monday00000035 (£1.00) (1: 1 x £1.00 per 1))
and without date time working:
Quote:
Shipping (Click & Collect Plus (£1.00) (1: 1 x £1.00 per 1))
Re: PHP Deprecated: Function strftime() is deprecated mixed text and date time ?
Oops...I see I missed my own comment on that bit "never tested" as I don't use that aspect and didn't check it when I did a global replace of this function. Sorry about that.
Re: PHP Deprecated: Function strftime() is deprecated mixed text and date time ?
Don't have to be sorry, thank you for trying, I think I will for now live with one error and have the wording I need.
Re: PHP Deprecated: Function strftime() is deprecated mixed text and date time ?
I've really got to think over this weekend if this is worth days of chasseing error or to just step back again to ZC v1.5.7d already stepped back from ZC V1.5.8a. to get this site Live then ldo a local install of ZC V2 and spend time getting that ready and make the few addon's i wish for then upgrade in my timeframe.