Closed MotyerJM closed 1 year ago
The way many computers represent dates is by counting the number of seconds elapsed since a specific instant. For UNIX based systems (and PHP uses the same model), the specific instant is January 1st, 1970, named the Unix epoch. So, for dates that happened before that origin, some systems use negative numbers.
For phpDVDProfiler, as the release date was originally thought to be the DVD release date, it made sense that those dates would always be later than 1970. So, the 'released' column in the database was defined as an unsigned integer, thus not permitting negative numbers...
Normally, if you run the following SQL command on your database, it should allow to store release dates prior to 1970:
ALTER TABLE DVDPROFILER_dvd MODIFY released INT(24) DEFAULT NULL;
My database was already configured like this, and it allowed me to import three DVDs with the release dates you mentioned without any problem. Hopefully, it's the only thing changed in the database model and it'll work for you too.
I'll add a database schema update script to the next release so that it's active for everyone.
You might have to run that one too, not sure exactly whether it's linked to the DVD release date too, or if I had it in my DB for another problem:
ALTER TABLE DVDPROFILER_dvd MODIFY lastedited INT(24) DEFAULT NULL;
After many hours of testing & troubleshooting, your allow-release-date-before-epoch.zip file seems to be for php7, maybe? I get the following error with PHP v8.0.10 selected on my server:
Fatal error: Uncaught ArgumentCountError: mysqli_error() expects exactly 1 argument, 0 given in D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\3925c79-movies\mysqli.php:53 Stack trace: #0 D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\3925c79-movies\mysqli.php(53): mysqli_error() #1 D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\3925c79-movies\global.php(699): sql_db->__construct() #2 D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\3925c79-movies\index.php(4): include_once('...') #3 {main} thrown in D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\3925c79-movies\mysqli.php on line 53
and
Fatal error: Uncaught ArgumentCountError: mysqli_error() expects exactly 1 argument, 0 given in D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\3925c79-tv\mysqli.php:53 Stack trace: #0 D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\3925c79-tv\mysqli.php(53): mysqli_error() #1 D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\3925c79-tv\global.php(699): sql_db->__construct() #2 D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\3925c79-tv\index.php(4): include_once('...') #3 {main} thrown in D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\3925c79-tv\mysqli.php on line 53
When I switch to PHP v7.4.0 on my server, you can see the results at these 2 links (default Login and Password):
https://www.fusionwings.com/3925c79-tv/ https://www.fusionwings.com/3925c79-movies/
I don't know why the execution of the above 2 collections show different errors under PHP v7.4.0, as the files are from your same zip file.
Sorry to be a pest.
Thanks for your tests. It looks like you have some database connection problem, you should check the database information in your configuration file (localsiteconfig.php).
I have now improved the detection of incorrect database connection configuration, and made sure that it works from PHP 7.4 to 8.2.
Could you please:
Under both PHP v8.0.10 and v7.4.0:
Notice: Trying to access array offset on value of type null in D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\877f583-movies\index.php on line 1434
and
877f583-tv: Warning: Trying to access array offset on value of type null in D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\877f583-tv\index.php on line 1434
https://www.fusionwings.com/877f583-movies/ https://www.fusionwings.com/877f583-tv/
Note: My website, under which all my phpDVDProfiler collections run, the CMS on that website is currently restricted to PHP v8.0.10, hence all my phpDVDProfiler testing is done up to PHP v8.0.10. However, I can also test using PHP v8.1.11, if you wish & if it might help you.
Regards & have a great day.
This is due to the fact that, after import, your collection is empty. Your collection is empty because of the following problems during import:
collection_movies_1970.xml: Profile IDs must not be blank. Profile #1
collection_movies_1970.xml: Profile IDs must not be blank. Profile #2
collection_movies_1970.xml: Profile IDs must not be blank. Profile #3
I've pushed a new commit to the feature/allow-release-date-before-epoch branch that will correctly display an empty collection. And I've opened issue #35 to fix the "Number of profiles added" displayed after the update when some profiles were not imported due to missing ID.
My apologies, for testing your pre-Epoch releases, I had exported only a few items that were pre-1970, and it was the exports that were causing the problems. Since exporting the entire collections, I am no longer getting those errors. Again, my apologies.
I did notice one issue, though, but it has nothing to do with your phpDVDProfiler. It seems that in my collections, when I export those collections, some profiles with release dates pre-1970 will show up in the exported XML file with the correct year, example 1 January 1956, and other similar profiles with release dates pre-1970 will show up in the exact same exported XML file as 1 January 2056. But as it is the exported XML files that have the 1956/2056 problem, it is the DVDProfiler program itself that is causing the problem, and NOT your phpDVDProfiler.
I will test your 1e29db8 for you later this evening, under both PHP v7.4.0 and 8.0.10.
Thanks for your time spent on this capability.
Thanks a lot for your tests and feedback. I'm happy to know that it works as expected for you, and I'll publish a new version on Sunday which will include this.
If you wish, I can also test both (this #33 pre-Epoch and the other #34 Thumbnails Banner) under PHP v8.1.11, before you publish the new version tomorrow. Or maybe you're confident that if it works under 8.0.10 that it will also work under 8.1.11.
I've tested both issues with PHP 7.4, 8.0, 8.1, and 8.2. So I'm quite confident that they will work on those versions (even though we've seen that it seems to be quite sensitive depending on small configuration changes 😉). I wanted you to do the previous tests mostly because you were the one expressing the need for these modifications, and I wanted to be sure that my implementation met your expectations. Thanks a lot for all the time you spent testing, and for the quality of your feedback too.
On both the Front and Back Galleries, I just noticed the following Warning:
**Warning**: imagecreatefrompng(): gd-png: libpng warning: iCCP: known incorrect sRGB profile in **D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\877f583-movies\functions.php** on line **407**
https://www.serendipity.cloud/877f583-movies/
Yes, I am using a different domain than before, so I can use phpDVDProfiler with the latest PHP that I have.
I checked the image & imagecache folders, but I have only JPG images in them. My only folder with PNGs are /gfx and /skins.
Just thought I would mention it, before your release tomorrow.
Update: 45 minutes later, and I am no longer getting that warning. I have not done anything to make that warning disappear.
On both the Front and Back Galleries, I just noticed the following Warning:
**Warning**: imagecreatefrompng(): gd-png: libpng warning: iCCP: known incorrect sRGB profile in **D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\877f583-movies\functions.php** on line **407**
Thanks. I had noticed the same warning and corrected the problematic images as part of commit 22ea1ca
Update: 45 minutes later, and I am no longer getting that warning. I have not done anything to make that warning disappear.
The warning mostly appears when generating the thumbnails with the media type banner. Once the images have been generated, the warning is no longer displayed as the problematic PNG image has been integrated in the thumbnail and converted to JPEG.
Using your v_20230102 release... all works good with my 4 of my 5 installations.
I have 1 install, though, that has 3 profiles with release dates of 1965, 1966 and 1968 respectively. It seems that mysqli.php does not like dates that far back, and all imports fail. The next old release date that I have is 1972, and that one works fine.
I confirmed the 1965, 1966 & 1968 dates by temporarily moving them out of my Owned category, and then exporting only my Owned category. The import was then successful. But with those 3 old profiles moved back to my Owned category, I get the error again & the import fails.
The release dates for those problem profiles are:
ERROR_LOG.txt
The strange thing is, I have another collection, with old release dates, and they import fine. Case in point is the following profile, with a release date of 16-May-47, and that collection imports fine, with no error.
Note that in this profile, phpDVDProfiler displays the date as 16 May 2047, instead of 16 May 1947, but at least that collection imports with no error:
https://www.fusionwings.com/movies/index.php?mediaid=202101080925&action=show
I realize that Release Dates are intended for when DVDs were released, but I use them for when the movies were released. And your previous releases from a few years ago did not have this issue with this particular collection.
Here's a link to that problem collection, as displayed following the import error (there should be at least 664 items in this collection, including child profiles):
https://www.fusionwings.com/tv/
Any thoughts?
As an aside, unrelated to the above issue, is that I was told a few years ago, that the reason why phpDVDProfiler cannot display dates prior to 1 January 1970, is that that is the Unix "epoch date", so a date in DVDProfiler prior to that, example of 11 August 1956, will display in phpDVDProfiler as 11 August 2056. However, what confuses me is, I have a genealogy PHP script (that uses MySQL) on my site that displays dates correctly, even back to years with only 3 digits (i.e. the year 743). So I'm unsure why phpDVDProfiler cannot display years correctly previous to 1 January 1970.
Sorry, no idea why the above 2 URLs are not working when clicked on.
Thank you in advance.
John Toronto-ish, Canada