Skip to content

Fix crash with PDF plugin virtual objects lacking getID()#405

Open
grillodemetal wants to merge 1 commit into
pluginsGLPI:masterfrom
grillodemetal:fix/pdf-plugin-getid-crash
Open

Fix crash with PDF plugin virtual objects lacking getID()#405
grillodemetal wants to merge 1 commit into
pluginsGLPI:masterfrom
grillodemetal:fix/pdf-plugin-getid-crash

Conversation

@grillodemetal

Copy link
Copy Markdown

The PDF plugin may pass virtual CommonGLPI objects such as PluginPdfComputer to:

Ocslink::getOCSServerForItem()

Those objects do not implement getID(), causing:

Attempted to call an undefined method named "getID"

This patch adds a defensive method_exists() validation before calling getID().

Result:

  • prevents fatal crash during PDF generation
  • keeps compatibility with OCS synchronization
  • improves compatibility with virtual/helper plugin objects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant