Skip to content
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

Fix(Mobilesync): prevent 'undefined index' when sync security #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stonebuzz
Copy link

Prevent PHP warning

[2024-07-12 15:36:40] glpiphplog.WARNING:   *** PHP Warning (2): Undefined array key "lost_location_latitude" in /mnt/diskhome/home/htdocs/marketplace/jamf/inc/mobilesync.class.php at line 397
  Backtrace :
  marketplace/jamf/inc/devicesync.class.php:256      PluginJamfMobileSync->syncSecurity()
  marketplace/jamf/ajax/merge.php:130                PluginJamfDeviceSync::sync()
  
[2024-07-12 15:36:40] glpiphplog.WARNING:   *** PHP Warning (2): Undefined array key "lost_location_longitude" in /mnt/diskhome/home/htdocs/marketplace/jamf/inc/mobilesync.class.php at line 398
  Backtrace :
  marketplace/jamf/inc/devicesync.class.php:256      PluginJamfMobileSync->syncSecurity()
  marketplace/jamf/ajax/merge.php:130                PluginJamfDeviceSync::sync()
  
[2024-07-12 15:36:40] glpiphplog.WARNING:   *** PHP Warning (2): Undefined array key "lost_location_altitude" in /mnt/diskhome/home/htdocs/marketplace/jamf/inc/mobilesync.class.php at line 399
  Backtrace :
  marketplace/jamf/inc/devicesync.class.php:256      PluginJamfMobileSync->syncSecurity()
  marketplace/jamf/ajax/merge.php:130                PluginJamfDeviceSync::sync()
  
[2024-07-12 15:36:40] glpiphplog.WARNING:   *** PHP Warning (2): Undefined array key "lost_location_speed" in /mnt/diskhome/home/htdocs/marketplace/jamf/inc/mobilesync.class.php at line 400
  Backtrace :
  marketplace/jamf/inc/devicesync.class.php:256      PluginJamfMobileSync->syncSecurity()
  marketplace/jamf/ajax/merge.php:130                PluginJamfDeviceSync::sync()
  
[2024-07-12 15:36:41] glpiphplog.WARNING:   *** PHP Warning (2): Undefined array key "lost_mode_enabled" in /mnt/diskhome/home/htdocs/marketplace/jamf/inc/mobilesync.class.php at line 393
  Backtrace :
  marketplace/jamf/inc/devicesync.class.php:256      PluginJamfMobileSync->syncSecurity()
  marketplace/jamf/ajax/merge.php:130                PluginJamfDeviceSync::sync()
  
[2024-07-12 15:36:41] glpiphplog.WARNING:   *** PHP Warning (2): Undefined array key "lost_mode_enforced" in /mnt/diskhome/home/htdocs/marketplace/jamf/inc/mobilesync.class.php at line 394
  Backtrace :
  marketplace/jamf/inc/devicesync.class.php:256      PluginJamfMobileSync->syncSecurity()
  marketplace/jamf/ajax/merge.php:130                PluginJamfDeviceSync::sync()
  
[2024-07-12 15:36:41] glpiphplog.WARNING:   *** PHP Warning (2): Undefined array key "lost_mode_message" in /mnt/diskhome/home/htdocs/marketplace/jamf/inc/mobilesync.class.php at line 395
  Backtrace :
  marketplace/jamf/inc/devicesync.class.php:256      PluginJamfMobileSync->syncSecurity()
  marketplace/jamf/ajax/merge.php:130                PluginJamfDeviceSync::sync()
  
[2024-07-12 15:36:41] glpiphplog.WARNING:   *** PHP Warning (2): Undefined array key "lost_mode_phone" in /mnt/diskhome/home/htdocs/marketplace/jamf/inc/mobilesync.class.php at line 396
  Backtrace :
  marketplace/jamf/inc/devicesync.class.php:256      PluginJamfMobileSync->syncSecurity()
  marketplace/jamf/ajax/merge.php:130                PluginJamfDeviceSync::sync()
  
[2024-07-12 15:36:41] glpiphplog.WARNING:   *** PHP Warning (2): Undefined array key "lost_location_latitude" in /mnt/diskhome/home/htdocs/marketplace/jamf/inc/mobilesync.class.php at line 397
  Backtrace :
  marketplace/jamf/inc/devicesync.class.php:256      PluginJamfMobileSync->syncSecurity()
  marketplace/jamf/ajax/merge.php:130                PluginJamfDeviceSync::sync()
  

@stonebuzz stonebuzz requested a review from cconard96 July 12, 2024 13:58
@stonebuzz stonebuzz self-assigned this Jul 12, 2024
@stonebuzz stonebuzz added the bug Something isn't working label Jul 12, 2024
@cconard96
Copy link
Collaborator

These properties should always be present in the API response.
What version of Jamf Pro are you testing with? I'm currently checking the managed cloud instance provided for CJ Development Studios, which is on 11.6.1 and these properties are present even when a device isn't in Lost Mode in both the XML and JSON response.

@stonebuzz
Copy link
Author

These properties should always be present in the API response. What version of Jamf Pro are you testing with? I'm currently checking the managed cloud instance provided for CJ Development Studios, which is on 11.6.1 and these properties are present even when a device isn't in Lost Mode in both the XML and JSON response.

11.6.1-t1718634702

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants