Closed SimSync closed 6 years ago
I've changed something for strptime on windows. But the Linux part is unchanged. This change is included in the official repo. regarding the second one, this might be a typo from me. I have to check this.
The outputs should be the same regardless of platform and supported PHP version. I'm concerned that e107 will behave differently on Windows and Unix.
Are you working on porting e_date::strptime() to Windows so that the result is identical to other platforms?
The issue came up when I wrote a test for toTime(). The result is wrong on windows. And the test fails on windows. That it didn't fail for you only supports my opinion that the strptime function is buggy. I think, we should create a new function based on https://secure.php.net/manual/en/function.date-parse-from-format.php date_parse_from_format(), which is available on all platforms and has not the issues which strptime has.
How many usages of e_date::strptime() would we have to account for to make a cross-platform alternative?
The only usage I see in the core is that e_date::toTime() function that you mentioned.
@Deltik I made changes to toTime() so it uses date_parse_from_format(), Still needs more testing.. and maybe the test improved for it?
@CaMer0n: Well, the tests that are failing for me specifically target the e_date::strptime() method, so there has not been a change in the test output.
e_dateTest::testToTime() is the one test that specifically tests e_date::toTime(), and it's still passing, so that's promising.
@CaMer0n For me the tests now succeed (toTime and strptime). @Deltik What is the output when you run the strptime tests? What is the value of the actual array?
@SimSync: Unchanged from my first comment
@Deltik So, your $actual array has additional entries, that are missing in the $expected array (tm_sec, tm_min, tm_hour, unparsed), but the existing entries match the expected ones (maybe different order...). OK, i'll check the strptime function for the missing entries.
strptime is not used by the core, but I guess there is always a chance that a third-party plugin is using it.
Some of these new tests have failed:
Is there an e107 commit or pull request that I need to make these tests pass?