-
Notifications
You must be signed in to change notification settings - Fork 74
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
New test failure in AdminSystemConfigurationExampleSessionID.t #2371
Comments
Boiled it down to a single commit. The error occurs in the commit a5e3233 but not in a5e3233^. The difference is not really apparent. In both cases the test script should click on the notification for dirty SysConfig, which is the link https://localhost:1484/otobo/index.pl?Action=AdminSystemConfigurationDeployment;Subaction=Deployment . But only a5e3233^ then redirects to the login page. On possibility is that in the working case there is some kind of JavaScript magic that makes no request to the server. The next step could be a comparison of the HTML that shows the notification. See #399. |
Might be related to OTRS/otrs@bd974e5#diff-8e6b4bce22cf7471e867d1b768cb1d147df1263aec09298ace8ae4cdccec2298. The session id should be added to the deployment link. |
Looks like the broken behavior is due to bugs that are fixed in
Things are fine when the comparision with the single letter string
Thus the comparison should fail. It did not fail because JSON.pm serializes the number 0 incorrenctly. Cpanel::JSON::XS serializes correctly but breaks the comparison.
This could be fixed by fiddling with Kernel/Output/HTLM/Layout/Template.pm . But this is confusing. I propose to fix the JS instead. There don't seem to be many occurrences.
|
Fixing this problem by making the following change:
The condition holds when SessionUseCookie is 0 or '0', which is the intended new behavior. |
The bang bang operator effectively casts a number to a boolean.
in the link of the deployment notification
Actually the problematic values, like '' and 0 were stored flawlessly, but they could not be retrieved. The default value was retrieved instead.
The previous fix fixed only half of the problem. The JavaScript method `Core.Config.Get(Key, DefaultValue) did not retrieve the value 0 for SessionUseCookie. Instead the undefined DefaultValue was retrieved. This broke the check whether SessionUseCookie has been disabled. Fixed
|
Because Subaction is the empty string per default. Empty strings can now be retrieved from Core.Config.
Test failures are almost gone now, but there is a new failure:
Looks like some kind of Layout issue, likely not related to the JSON changes. Let's handle this in a new issue. |
Closing as tests look fine. |
The change
must be rolled back as there were instances where GUI broke. One example is the PictureUploadAction in Kernel/Output/HTML/Layout.pm . Reopening this issue. |
Returning the default value is now triggered again by the truthiness of the stored value. Note that the string containing the digit 0 is true.
Issue #2371: revert changes in the Get() method
That the change has to be reverted is clear. However there are five new test failures in the test suite, including the original errorAdminSystemConfigurationExampleSessionID.t. I merged anyways and accept that there are some intermediary failures. Here is the analysis part. It was already stated above that the problem can be highlighted by dumping a numeric Sysconfig setting one time with JSON and the other time Cpanel::JSON::XS. otobo@ad98e2ba4b0f: Further debugging showed that the versions of the JSON libraries do not matter. The explanation why SessionUseCookie is considered one time as a string and the other time as number is not obvious. But the relevant hint is right in the documentation of Cpanel::JSON::XS: https://metacpan.org/pod/Cpanel::JSON::XS#simple-scalars .
For SessionUseCookie this checks out. The number is created by running ZZZAAuto,pm and never meddled with, e.g. printed, before converted to JSON. JSON::XS follows more or less the same strategy but apparently there are differences in details. The take home message is that the decision why a (numeric) value is represented as JSON as a string might be deterministic, but not transparent. So the next best idea is to force transparency. This can be done by setting $json->type_all_string(1) for the values that are passed into the JavaScript World. This is a simple rule, that forces stringiness on the numbers. It seems to be in line with the current implementation: otobo$ grep -r Core.Config.Get var/httpd/htdocs/js/ | grep parseInt | wc -l |
This reverts commit 70dd115. Because the JavaScript method Core.Config.Get() had been reverted to the strange old behavior where the default value is returned when the stored value is false.
This is fixed with the changes done for #2595 . |
Since 2023-05-18, that is the first test run with Cpanel::JSON::XS, the test scripts/test/Selenium/Agent/Admin/AdminSystemConfigurationExampleSessionID.t reports an error. Here is the relevant snippet.
It is not obvious what the correct behavior is. The test script does:
The last assertion fails, there is a redirect to the login page. This makes sense, as the session cookie is turned off.
TODO:
The text was updated successfully, but these errors were encountered: