TY. Over to you, @strelitzia.
Printable View
TY. Over to you, @strelitzia.
I am getting a 500 error when trying to go to the config page in admin for ceon Version: 5.1.0 from the GitHub using zencart v1.5.8a and php 8.1. I added a .htaccess file to the directory. I get the following error in my log files.
[10-Sep-2023 21:00:19 America/Los_Angeles] PHP Fatal error: Unparenthesized `a ? b : c ? d : e` is not supported. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in /home/folder/domain.com/admin/includes/classes/class.CeonURIMappingInstallOrUpgrade.php on line 467
I must have done something wrong. Could use a hand as I am have been trying to figure this one out for hours.
@jasonshanks It's some PHP code in that file that needs brackets adding, e.g.:
Should be something like:Code:'product_reviews' =>
isset($default_uri_parts[$default_language_code]['product_reviews']) ?
$default_uri_parts[$default_language_code]['product_reviews'] :
isset($default_uri_parts['en']['product_reviews']) ?
$default_uri_parts['en']['product_reviews'] : 'Reviews',
5 instances need replacing. I think you just have to edit it yourself, the latest blob at the repo I think is 'current' doesn't have this fix either. https://github.com/JSWebSteve/Ceon-U...lOrUpgrade.phpCode:'product_reviews' =>
isset($default_uri_parts[$default_language_code]['product_reviews']) ?
$default_uri_parts[$default_language_code]['product_reviews'] :
(isset($default_uri_parts['en']['product_reviews']) ?
$default_uri_parts['en']['product_reviews'] : 'Reviews'),
Thank you so much. I had uninstalled that copy out of frustration of not knowing what to do or how to find out. And was going to install 1.5.7 , but i think i will give it another shot. Thank you.
No worries. It's not the version of Zen Cart that's causing your problem, it's your PHP 8.1. I presume you had an earlier version last time this worked for you. From a quick search, see https://lindevs.com/nested-ternary-o...ses-in-php-8-0 "Since PHP 8.0, the nested ternary operators require explicit parentheses and using without them, a fatal error occurs."
I actually first ran into this in core Zen Cart, `enable_error_logging.php` used to have an ugly ternary operator when building its bitmask for log levels, but the latest version seems to have had this removed. A lot of work has been done by the faithful devs to fix a wide array of Errors since PHP 8.0, 8.1 and soon 8.2 turn old Deprecated warnings into Fatal Errors.
are these the 5 instances you mentioned ?
isset($default_uri_parts[$default_language_code]['product_reviews']) ?
$default_uri_parts[$default_language_code]['product_reviews'] :
isset($default_uri_parts['en']['product_reviews']) ?
$default_uri_parts['en']['product_reviews'] : 'Reviews',
'product_reviews_info' =>
isset($default_uri_parts[$default_language_code]['product_reviews_info']) ?
$default_uri_parts[$default_language_code]['product_reviews_info'] :
isset($default_uri_parts['en']['product_reviews_info']) ?
$default_uri_parts['en']['product_reviews_info'] : 'Review',
'product_reviews_write' =>
isset($default_uri_parts[$default_language_code]['product_reviews_write']) ?
$default_uri_parts[$default_language_code]['product_reviews_write'] :
isset($default_uri_parts['en']['product_reviews_write']) ?
$default_uri_parts['en']['product_reviews_write'] : 'Write a Review',
'tell_a_friend' => isset($default_uri_parts[$default_language_code]['tell_a_friend']) ?
$default_uri_parts[$default_language_code]['tell_a_friend'] :
isset($default_uri_parts['en']['tell_a_friend']) ?
$default_uri_parts['en']['tell_a_friend'] : 'Tell a Friend',
'ask_a_question' => isset($default_uri_parts[$default_language_code]['ask_a_question']) ?
$default_uri_parts[$default_language_code]['ask_a_question'] :
isset($default_uri_parts['en']['ask_a_question']) ?
$default_uri_parts['en']['ask_a_question'] : 'Ask a Question'
);
I tried doing the same thing to them all but still get 500 error. Gonna undo and try again.
I guess i am messing something up. But i can't for the life of me figure it out.
'product_reviews' =>
isset($default_uri_parts[$default_language_code]['product_reviews']) ?
$default_uri_parts[$default_language_code]['product_reviews'] :
(isset($default_uri_parts['en']['product_reviews']) ?
$default_uri_parts['en']['product_reviews'] : 'Reviews'),
'product_reviews_info' =>
isset($default_uri_parts[$default_language_code]['product_reviews_info']) ?
$default_uri_parts[$default_language_code]['product_reviews_info'] :
(isset($default_uri_parts['en']['product_reviews_info']) ?
$default_uri_parts['en']['product_reviews_info'] : 'Review'),
'product_reviews_write' =>
isset($default_uri_parts[$default_language_code]['product_reviews_write']) ?
$default_uri_parts[$default_language_code]['product_reviews_write'] :
(isset($default_uri_parts['en']['product_reviews_write']) ?
$default_uri_parts['en']['product_reviews_write'] : 'Write a Review'),
'tell_a_friend' => isset($default_uri_parts[$default_language_code]['tell_a_friend']) ?
$default_uri_parts[$default_language_code]['tell_a_friend'] :
(isset($default_uri_parts['en']['tell_a_friend']) ?
$default_uri_parts['en']['tell_a_friend'] : 'Tell a Friend'),
'ask_a_question' => isset($default_uri_parts[$default_language_code]['ask_a_question']) ?
$default_uri_parts[$default_language_code]['ask_a_question'] :
(isset($default_uri_parts['en']['ask_a_question']) ?
$default_uri_parts['en']['ask_a_question'] : 'Ask a Question'
);
I changed all 5 of them to be like yours but still getting 500 on the admin config page.
Your last one, ask_a_question, needs a final closing bracket.
(the final bracket after 'Ask a Question' matches the one on the previous line before isset).Code:'ask_a_question' => isset($default_uri_parts[$default_language_code]['ask_a_question']) ?
$default_uri_parts[$default_language_code]['ask_a_question'] :
(isset($default_uri_parts['en']['ask_a_question']) ?
$default_uri_parts['en']['ask_a_question'] : 'Ask a Question')
So i did a judo solution / temp fix. I just asked my host to downgrade my php to 7.4 which is what my main site has been running on with its 1.5.6 install. Now ceon works fine. I will try to watch some beginner videos on php so i can at least understand you guys when you try to help me. Again I apologize if i wasted your time. I know all of you do this stuff for free and I really appreciate everything all of you do.