We are seeing several errors with regard to keys not set:
1) Warning: Undefined array key "_cvar" in Drupal\visitors\Service\TrackerService->write() (line 112 of /modules/contrib/visitors/src/Service/TrackerService.php) [ addressed in issue https://www.drupal.org/project/visitors/issues/3389685 ]
2) The various errors reported here: https://www.drupal.org/project/visitors/issues/3380760
In ADDITION we are seeing these new errors:
3) Warning: Undefined array key "url" in Drupal\visitors\Service\TrackerService->write() (line 129 of \modules\contrib\visitors\src\Service\TrackerService.php)
4) Warning: Undefined array key "uid" in Drupal\visitors\Service\TrackerService->write() (line 126 of \modules\contrib\visitors\src\Service\TrackerService.php)
The underlying issue, in all cases, seems to be that $agent may not always have all values set.
Therefore, I would suggest to give reasonable default values for all $agent values, just in case if one is missing.
In our case, I added this code, just to get past this, but there are other $agent values, and these should have defaults as well. I am not sure what you may use as a "reasonable default", but all values should get one.
if ( !isset($agent['uid']))
$agent['uid'] = \Drupal::currentUser()->id();
if ( !isset($agent['url'])){
$current_path = \Drupal::service('path.current')->getPath();
$agent['url'] = \Drupal::service('path_alias.manager')->getAliasByPath($current_path);
}
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | visitors_3413155.patch | 4.26 KB | abhishek_gupta1 |
Issue fork visitors-3413155
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
hoporr commentedComment #3
bluegeek9 commentedI believe this has already been fixed in dev.
Comment #6
abhishek_gupta1 commented@hoporr, I have fixed the issue and created Patch. please kindly review the Patch file
Comment #7
bluegeek9 commentedComment #10
bluegeek9 commentedThis issue was resolved. A new release, 8.x-2.17, will be made soon, May 31st.
This is an excellent opportunity to beta test the dev branch, and report any issues.
Contributors (5)
bluegeek9, roshni27, abhishek_gupta1, sarwan_verma, SandeepSingh199
Changelog
Issues: 32 issues resolved.
Changes since 8.x-2.16:
Bug
Feature
Task