Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date comparison datatype issue results in error #23

Open
RyanDrewniak opened this issue Aug 9, 2024 · 4 comments
Open

Date comparison datatype issue results in error #23

RyanDrewniak opened this issue Aug 9, 2024 · 4 comments

Comments

@RyanDrewniak
Copy link

Bug description

When I use this plugin on my staging environment, I get the following fatal error:

Object of class Illuminate\\Support\\Carbon could not be converted to int

which is triggered at:

vendor/mitydigital/sitemapamic/src/Support/Sitemapamic.php:303

Steps to reproduce

Install the plugin on a site running Statamic v5.20.0 and load the sitemap.xml URL from any web browser.

Environment and versions

Environment
Laravel Version: 10.48.12
PHP Version: 8.2.20
Composer Version: 2.2.6
Environment: development
Debug Mode: ENABLED
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: redis
Database: mysql
Logs: stack / single, slack
Mail: mailgun
Queue: sync
Session: redis

Livewire
Livewire: v3.4.9

Sentry
Enabled: YES
Environment: development
Laravel SDK Version: 4.6.1
PHP SDK Version: 4.8.0
Release: NOT SET
Sample Rate Errors: 100%
Sample Rate Performance Monitoring: NOT SET
Sample Rate Profiling: NOT SET
Send Default PII: DISABLED

Statamic
Addons: 5
Sites: 5
Stache Watcher: Disabled
Static Caching: Disabled
Version: 5.20.0 PRO

Statamic Addons
alt-design/alt-redirect: 1.3.2
jacksleight/statamic-bard-mutator: 2.3.1
jacksleight/statamic-bard-texstyle: 3.2.3
mitydigital/sitemapamic: 3.1.0
statamic/eloquent-driver: 4.12.3

Statamic Eloquent Driver
Asset Containers: file
Assets: file
Blueprints: file
Collection Trees: eloquent
Collections: eloquent
Entries: eloquent
Forms: eloquent
Global Sets: eloquent
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: eloquent
Revisions: eloquent
Sites: file
Taxonomies: eloquent
Terms: eloquent
Tokens: file

Additional details

To test the issue, I inserted a dd($entryLastMod, $lastMod); at line 301 of the vendor/mitydigital/sitemapamic/src/Support/Sitemapamic.php file. When I do so, the $entryLastMod variable is presented as an int but the $lastMod is set as a Carbon object.

@RyanDrewniak
Copy link
Author

RyanDrewniak commented Aug 9, 2024

I did some additional debugging and just submitted a forked pull request that should fix the problem: #24

@martyf
Copy link
Contributor

martyf commented Aug 9, 2024

Before merging the PR I'd like to be able to replicate it as I've not seen this happen in any environment before.

I've done a clean install but runs for me.

What is special about your environment that is causing this issue to occur?

Can you reproduce it in a repo? I've set up a new site, with L10, Eloquent driver, but can't replicate this issue. While the PR does fix it, I'd also like to understand what is causing the issue too.

@RyanDrewniak
Copy link
Author

That's so unbelievably bizarre...I tried in a different environment (3 different environments now) with the exact same dataset, but I can't replicate the issue. I'm thinking it may be related to some separate server configuration setting on that one environment.

@martyf
Copy link
Contributor

martyf commented Aug 10, 2024

Just to be clear too, I’m not discounting the issue either: just want to understand why it’s happening.

Can you dig a little deeper with a fresh install on the same environment to find the right steps to replicate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants