ryanhowdy / fcms

Family Connections - Create a private family website.
http://www.familycms.com
GNU General Public License v2.0
82 stars 41 forks source link

Mostly lost recipes #623

Closed GregLeonhardt closed 1 year ago

GregLeonhardt commented 3 years ago

Recipes are being dropped from the 'Recipes" page 90 seconds after being entered.

Test Method: 1) Enter a new recipe 2) After the formatted recipe is displayed click 'Recipe Categories'

    The recipe title is displayed as expected.

3) Wait 90 seconds (from when the recipe was first entered) and click the web browser refresh button.

    The recipe title will have vanished.

4) Go back to the 'Home' page and click on the recipe title in 'What's New'.

    The recipe will be displayed.

In conclusion the recipe itself is still in the system but after the announcement falls off the home page it will be inaccessible.

The above steps reproduced the error with a clean install of 'fcms-3.7.0'

ryanhowdy commented 3 years ago

Do you have a bunch of recipes in this test? When i try this with just 1 recipe, i cannot reproduce.

GregLeonhardt commented 3 years ago

Well that's curious. I created a clean install just to confirm it wasn't being caused by anything else.

As to the number of recipes: I see the problem on the first the first through last. If there are already recipes saved, the new one will be displayed for 90 seconds then vanish. If you can enter multiple recipes within 90 seconds everything that is less than 90 seconds old will be displayed.

I just had a thought and went into the database with MySQL Workbench and updated the 'date' column to a current date/time and the recipe title once again appeared. (Well until 90 seconds after the time I entered then it vanished again.)

The page I am looking at is Home -> Recipes or Home -> Recipes -> {Recipe Category}

I attached the FCMS log. Let me know if there is another that could shed some light on the problem.

=================================================================== Distributor ID: Raspbian Description: Raspbian GNU/Linux 9.13 (stretch) Release: 9.13 Codename: stretch

PHP 7.0.33-0+deb9u10 (cli) (built: Oct 6 2020 17:08:28) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.33-0+deb9u10, Copyright (c) 1999-2017, by Zend Technologies

mysql Ver 15.1 Distrib 10.1.48-MariaDB, for debian-linux-gnueabihf (armv7l) using readline 5.2

Server version: Apache/2.4.25 (Raspbian) Server built: 2021-07-09T08:12:34

log_2021-07-14.txt

GregLeonhardt commented 3 years ago

You say that you can't reproduce the problem. Are you testing with 3.7.0 or a compilation of fixed that will eventually be in 3.8.0? If it's the later then this is most likely a duplicate of #553 and nothing else is required. The main difference is that I do NOT see any errors in the log when this error occurs.

inc/datetime.php @ 314 $mins = round($diff / MINUTE_IN_SECONDS); which is used @ line 321 $since = sprintf(T_ngettext('%s minute ago', '%s minutes ago', $mins), $mins);

Eventually the execution flow gets to inc/thirdparty/php-gettext/gettext.php @ 379 ngettext($single, $plural, $number){

Now if "$this->short_circuit" is true everything just works. However if "$this->short_circuit" is NOT true the code will work it's way to inc/thirdparty/php-gettext/gettext.php @ 352 select_string($n){

This function starts with starts with: if (!is_int($n)) { throw new InvalidArgumentException( "Select_string only accepts integers: " . $n);

The problem is that round( ) returns a float which is incompatible with select_string() as it requires $n to be an int.

It's beyond my ability to determine when and why 'short_circuit' is set true. I can only say that in my installation it is false when displaying recipes.

ryanhowdy commented 3 years ago

Sorry, I did test this on 3.8.0, so hopefully it is a duplicate.