Recipe book

Andy's Avatar

Andy

30 Oct, 2017 05:03 PM

I'm having an issue with the recipe book.... I am able to create new recipes, and they get entered into the database, and I can view them for up to 59 seconds after posting. After that, I'm getting a fatal error when trying to view the recipes. I've tried removing special characters, and still can't get it to work. I'm thinking it is either a PHP setting, or an error within the database, but can't seem to find it.

Installed on IIS 8.5, PHP 5.6.3, and MySQL. Any help is appreciated.

Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Select_string only accepts integers: 4' in PATHTOSITE\inc\thirdparty\php-gettext\gettext.php:354 Stack trace: #0 PATHTOSITE\inc\thirdparty\php-gettext\gettext.php(388): gettext_reader->select_string(4) #1 PATHTOSITE\inc\thirdparty\php-gettext\gettext.inc(293): gettext_reader->ngettext('%s minute ago', '%s minutes ago', 4) #2 PATHTOSITE\inc\thirdparty\php-gettext\gettext.inc(411): _ngettext('%s minute ago', '%s minutes ago', 4) #3 PATHTOSITE\inc\datetime.php(321): T_ngettext('%s minute ago', '%s minutes ago', 4) #4 PATHTOSITE\inc\recipes_class.php(229): getHumanTimeSince(1509382351) #5 PATHTOSITE\recipes.php(854): Recipes->showRecipeInCategory(6, 1) #6 PATHTOSITE\recipes.php(1 in C:\inetpub\wwwroot\SterlingTechSystems\Family\inc\thirdparty\php-gettext\gettext.php on line 354

  1. 1 Posted by Andy on 30 Oct, 2017 06:01 PM

    Andy's Avatar

    I would also like to add, that if I access the recipe via "What's new" on the home page, I can view the recipe just fine. The error is only on the "recipe" page, when trying to view by category.

  2. Support Staff 2 Posted by Ryan Haudenschi... on 30 Oct, 2017 06:06 PM

    Ryan Haudenschilt's Avatar

    Well i can't seem to reproduce this error, but it looks like a problem in inc/datetime.php.

    If you could replace lines 312 through 366 of inc/datetime.php with the following code, i think it will work.

        // minutes
        // 1 - 59 minutes ago
        elseif ($diff < HOUR_IN_SECONDS)
        {
            $mins = round($diff / MINUTE_IN_SECONDS);
            if ($mins <= 1)
            {
    $mins = 1; } $mins = (int)$mins; $since = sprintf(T_ngettext('%s minute ago', '%s minutes ago', $mins), $mins); } // hours // 1 - 23 hours ago elseif ($diff < DAY_IN_SECONDS) { $hours = round($diff / HOUR_IN_SECONDS); if ($hours <= 1) {
    $hours = 1; } $hours = (int)$hours; $since = sprintf(T_ngettext('%s hour ago', '%s hours ago', $hours), $hours); } // days // 1 - 29 days ago elseif ($diff < MONTH_IN_SECONDS) { $days = round($diff / DAY_IN_SECONDS); if ($days <= 1) { $days = 1; } $days = (int)$days; $since = sprintf(T_ngettext('%s day ago', '%s days ago', $days), $days); } // months // 30 - 364 days ago elseif ($diff < YEAR_IN_SECONDS) { $months = round($diff / MONTH_IN_SECONDS); if ($months <= 1) { $months = 1; } $months = (int)$months; $since = sprintf(T_ngettext('%s month ago', '%s months ago', $months), $months); } // years // 365+ days ago elseif ($diff >= YEAR_IN_SECONDS) { $years = round($diff / YEAR_IN_SECONDS); if ($years <= 1) { $years = 1; } $years = (int)$years; $since = sprintf(T_ngettext('%s year ago', '%s years ago', $years), $years); }
  3. 3 Posted by Andrew Kruse on 30 Oct, 2017 06:48 PM

    Andrew Kruse's Avatar

    That worked like a charm, thank you very very much! The variables for Year
    month and date just weren't being carried through the array?

    If you need any help with testing on IIS, I can definitely help to be a
    guinea pig. I'm not INCREDIBLY great with PHP, but can generally fight my
    way out of a wet paper bag.

    I really appreciate it! Can't thank you enough for the quick support, and
    an AWESOME site!

    Thanks,

  4. Support Staff 4 Posted by Ryan Haudenschi... on 30 Oct, 2017 06:49 PM

    Ryan Haudenschilt's Avatar

    Awesome.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

14 Dec, 2018 09:31 PM
07 Dec, 2018 09:37 PM
07 Dec, 2018 04:55 PM
26 Nov, 2018 05:38 PM
26 Nov, 2018 05:37 PM