- Issue created by @joshuasosa
@joshuasosa,
I am unable to reproduce the error. Could you please provide steps to reproduce?- π¬π§United Kingdom aaron.ferris
aaron.ferris β made their first commit to this issueβs fork.
- π¬π§United Kingdom aaron.ferris
Raised an MR that will hopefully resolve this, looking at
if (!isset($style->vTimezone)) { $style->vTimezone = new \Eluceo\iCal\Component\Timezone($tz); }
From ViewsIcalHelper I believe the definition is correct.
- Status changed to Needs review
4 months ago 9:58am 2 August 2024 - π¨π·Costa Rica yuvania
Hi @aaron.ferris ,
- I tested the change https://git.drupalcode.org/issue/views_ical-3465114/-/commit/b718fd9d626... where the property vTimezone was added to the style, and it works perfectly. I had considered the same solution, and here's why it makes sense:
- Avoiding Deprecated Dynamic Properties: By defining the property explicitly in the class, we prevent PHP 8.3's deprecation warnings about dynamic property creation. This keeps our code future-proof and aligns with best practices.
- Logical Association: vTimezone is intrinsically tied to the style's configuration and state. Placing it within the style ensures that all relevant data and behavior are encapsulated within the appropriate object.
- Maintaining Functionality: This change preserves the existing functionality and ensures that time zone transitions are correctly managed and applied within the iCal generation.
Thanks for the merge request! It should help maintain compatibility with newer PHP versions while keeping the module's functionality intact.
- Status changed to RTBC
4 months ago 10:37am 2 August 2024 - πΊπΈUnited States bburg Washington D.C.
You don't need to run this issue through ChatGPT. Just say you tested it, and looks good to you.
I'll take a look at the patch and merge if it looks good.
- πΊπΈUnited States joshuasosa
This MR now produces an error for me:
Error: Cannot access protected property Drupal\views_ical\Plugin\views\style\IcalWizard::$vTimezone in Drupal\views_ical\ViewsIcalHelper->addTimezone() (line 409 of /modules/contrib/views_ical/src/ViewsIcalHelper.php). - π¬π§United Kingdom aaron.ferris
Updated the MR, wondering if we want to approach this in a different way.
- πΊπΈUnited States joshuasosa
The updated MR did resolve the warning (thanks!) but it looks like there's more. Not sure how many more there will be.
Deprecated function: Creation of dynamic property Drupal\views_ical\Plugin\views\style\IcalWizard::$checktransitions is deprecated in Drupal\views_ical\ViewsIcalHelper->addTimezone() (line 349 of /modules/contrib/views_ical/src/ViewsIcalHelper.php)
- Status changed to Needs review
3 months ago 6:52pm 30 August 2024 - πΊπΈUnited States bburg Washington D.C.
I would prefer to use getters and setters here. I went ahead and pushed a new commit which does that. Also removed a seemingly unnecessary line which was causing the warning joshuasosa pointed out.
Changing to needs to get some additional confirmation the updated patch works for other folks.
- πΊπΈUnited States joshuasosa
With #13's updated MR I get this whitescreen error:
TypeError: Drupal\views_ical\Plugin\views\style\IcalWizard::setVTimezone(): Argument #1 ($vTimezone) must be of type Drupal\views_ical\Plugin\views\style\Eluceo\iCal\Component\Timezone, Eluceo\iCal\Component\Timezone given, called in /modules/contrib/views_ical/src/ViewsIcalHelper.php on line 407 in Drupal\views_ical\Plugin\views\style\IcalWizard->setVTimezone() (line 116 of /modules/contrib/views_ical/src/Plugin/views/style/IcalWizard.php).
If I change
$style->setVTimezone(new Timezone($tz));
back to$style->vTimezone = new \Eluceo\iCal\Component\Timezone($tz);
it works again.The deprecation warning I posted previously seems to nicely be gone.
The next deprecated warning is given:Deprecated function: Creation of dynamic property Drupal\views_ical\Plugin\views\style\IcalWizard::$usedTimezoneTransitions is deprecated in Drupal\views_ical\ViewsIcalHelper->addTimezone() (line 347 of /modules/contrib/views_ical/src/ViewsIcalHelper.php)