mirror of
https://github.com/rlanvin/php-rrule.git
synced 2025-02-26 15:54:14 +01:00
Fix #103 createFromRfcString forced uppercase
This commit is contained in:
parent
5ef9eedb5d
commit
2221e8cdac
10
CHANGELOG.md
10
CHANGELOG.md
@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
|
||||||
|
## [2.3.2] - 2022-05-03
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fix timezone (and the entire rule) changed to uppercase if rule was created using `createdFromRfcString` [#103](https://github.com/rlanvin/php-rrule/issues/103)
|
||||||
|
|
||||||
## [2.3.1] - 2022-04-22
|
## [2.3.1] - 2022-04-22
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
@ -223,7 +230,8 @@
|
|||||||
|
|
||||||
- First release, everything before that was unversioned (`dev-master` was used).
|
- First release, everything before that was unversioned (`dev-master` was used).
|
||||||
|
|
||||||
[Unreleased]: https://github.com/rlanvin/php-rrule/compare/v2.3.1...HEAD
|
[Unreleased]: https://github.com/rlanvin/php-rrule/compare/v2.3.2...HEAD
|
||||||
|
[2.3.2]: https://github.com/rlanvin/php-rrule/compare/v2.3.1...v2.3.2
|
||||||
[2.3.1]: https://github.com/rlanvin/php-rrule/compare/v2.3.0...v2.3.1
|
[2.3.1]: https://github.com/rlanvin/php-rrule/compare/v2.3.0...v2.3.1
|
||||||
[2.3.0]: https://github.com/rlanvin/php-rrule/compare/v2.2.2...v2.3.0
|
[2.3.0]: https://github.com/rlanvin/php-rrule/compare/v2.2.2...v2.3.0
|
||||||
[2.2.2]: https://github.com/rlanvin/php-rrule/compare/v2.2.1...v2.2.2
|
[2.2.2]: https://github.com/rlanvin/php-rrule/compare/v2.2.1...v2.2.2
|
||||||
|
@ -670,8 +670,8 @@ class RRule implements RRuleInterface
|
|||||||
|
|
||||||
if (! $force_rset) {
|
if (! $force_rset) {
|
||||||
// try to detect if we have a RRULE or a set
|
// try to detect if we have a RRULE or a set
|
||||||
$string = strtoupper($string);
|
$upper_string = strtoupper($string);
|
||||||
$nb_rrule = substr_count($string, 'RRULE');
|
$nb_rrule = substr_count($upper_string, 'RRULE');
|
||||||
if ($nb_rrule == 0) {
|
if ($nb_rrule == 0) {
|
||||||
$class = '\RRule\RRule';
|
$class = '\RRule\RRule';
|
||||||
}
|
}
|
||||||
@ -680,7 +680,7 @@ class RRule implements RRuleInterface
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$class = '\RRule\RRule';
|
$class = '\RRule\RRule';
|
||||||
if (strpos($string, 'EXDATE') !== false || strpos($string, 'RDATE') !== false || strpos($string, 'EXRULE') !== false) {
|
if (strpos($upper_string, 'EXDATE') !== false || strpos($upper_string, 'RDATE') !== false || strpos($upper_string, 'EXRULE') !== false) {
|
||||||
$class = '\RRule\RSet';
|
$class = '\RRule\RSet';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2520,6 +2520,13 @@ class RRuleTest extends TestCase
|
|||||||
$this->assertInstanceOf('\RRule\RSet', $object);
|
$this->assertInstanceOf('\RRule\RSet', $object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCreateFromRfcStringDoesntChangeCase()
|
||||||
|
{
|
||||||
|
$str = "DTSTART;TZID=Europe/Paris:20200929T000000\nRRULE:FREQ=DAILY;BYSECOND=0;BYMINUTE=0;BYHOUR=9";
|
||||||
|
$rule = RRule::createFromRfcString($str);
|
||||||
|
$this->assertEquals($str, $rule->rfcString());
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Timezone
|
// Timezone
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user