-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Test ext/intl/tests/calendar_clear_variation1.phpt fails with ICU 73.1 #11128
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
Comments
The test failed for all versions (8.0-8.2) |
Implementation of the method got no changes and no changes at https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/deprecated.html php-src/ext/intl/calendar/calendar_methods.cpp Lines 440 to 462 in 976d7ed
|
Used to build example app and found that
#include "unicode/calendar.h"
#include "unicode/gregocal.h"
#include <stdio.h>
using namespace icu;
extern "C" void c_main();
void cpp_main()
{
//cout << "CPP API " << endl;
puts("CPP API");
UErrorCode status = U_ZERO_ERROR;
GregorianCalendar* gc = new GregorianCalendar(status);
gc->set(2012, UCAL_FEBRUARY, 29);
printf("before clear - year: %d, month: %d (%d in the implementation), day: %d\n",
gc->get(UCAL_YEAR, status),
gc->get(UCAL_MONTH, status) + 1,
gc->get(UCAL_MONTH, status),
gc->get(UCAL_DATE, status));
gc->clear(UCAL_MONTH);
gc->clear(UCAL_DATE);
printf("after clear - year: %d, month: %d (%d in the implementation), day: %d\n",
gc->get(UCAL_YEAR, status),
gc->get(UCAL_MONTH, status) + 1,
gc->get(UCAL_MONTH, status),
gc->get(UCAL_DATE, status));
delete gc;
}
int main()
{
cpp_main();
c_main();
return 0;
}
#include "unicode/ucal.h"
#include <stdio.h>
void c_main()
{
puts("C API");
UErrorCode status = U_ZERO_ERROR;
int32_t i;
UCalendar *cal = ucal_open(NULL, -1, NULL, UCAL_GREGORIAN, &status);
ucal_set(cal, UCAL_YEAR, 2012);
ucal_set(cal, UCAL_MONTH, UCAL_FEBRUARY);
ucal_set(cal, UCAL_DATE, 29);
printf("before clear - year: %d, month: %d (%d in the implementation), day: %d\n",
ucal_get(cal, UCAL_YEAR, &status),
ucal_get(cal, UCAL_MONTH, &status) + 1,
ucal_get(cal, UCAL_MONTH, &status),
ucal_get(cal, UCAL_DATE, &status));
ucal_clearField(cal, UCAL_MONTH);
printf("after clear - year: %d, month: %d (%d in the implementation), day: %d\n",
ucal_get(cal, UCAL_YEAR, &status),
ucal_get(cal, UCAL_MONTH, &status) + 1,
ucal_get(cal, UCAL_MONTH, &status),
ucal_get(cal, UCAL_DATE, &status));
ucal_close(cal);
} |
The output for
and previous (alpine:3.17)
|
Looks the only way to fix it is to use c++ API |
This fails on macOS on GitHub actions now too, probably due to an update of ICU. @andypost was this reported upstream? |
Not yet as I failed to find docs for it( |
@andypost I haven't looked at this in detail yet, but I was confused that we're using the C++ API that is broken with 72.1 in your example. php-src/ext/intl/calendar/calendar_methods.cpp Lines 454 to 458 in 724af01
But the test works fine for me with ICU 72.1. I'm not sure if some specific calendar condition makes it work/fail. |
yes, the issue started to happen with 73.1 - Alpinelinux used to upgrade earlier so I hit it |
I think this is just a problem with the test. |
I can't find any FIELD_ORDINAL_MONTH mentions, where it from? |
ICU 73 introduces the UCAL_ORDINAL_MONTH field. We need to clear it so that UCAL_MONTH doesn't get repopulated. Fixes phpGH-11128
@andypost https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/ucal_8h.html#a02fe23bf33319052733c00c7a09ea912a1a565b5618fbb006c9b48b48f06a0167 It is also flagged as "draft API". It seems weird to me that introducing new fields can break |
ICU 73 introduces the UCAL_ORDINAL_MONTH field. We need to clear it so that UCAL_MONTH doesn't get repopulated. Fixes phpGH-11128
I created https://unicode-org.atlassian.net/browse/ICU-22424 in the meantime. |
Description
The following code:
latest commit 976d7ed
Resulted in this output:
But I expected this test to pass which means that month field is not cleared
php-src/ext/intl/tests/calendar_clear_variation1.phpt
Line 16 in 976d7ed
PHP Version
master
Operating System
Alpinelinux
The text was updated successfully, but these errors were encountered: