Skip to content

fix: avoid global Parser class collision (#11)#16

Open
anna-d wants to merge 1 commit into
masterfrom
fix/parser-class-collision-11
Open

fix: avoid global Parser class collision (#11)#16
anna-d wants to merge 1 commit into
masterfrom
fix/parser-class-collision-11

Conversation

@anna-d

@anna-d anna-d commented Sep 15, 2025

Copy link
Copy Markdown
Contributor

Summary

This PR fixes a fatal error that occurs when WP File Search is activated
alongside plugins that also declare a global Parser class (e.g., Ninja Forms).

Error example:
Fatal error: Cannot declare class Parser, because the name is already in use

Changes

  • Renamed base class:
    • ParserWFS_Parser
  • Renamed concrete parsers:
    • PdfWFS_Parser_Pdf
    • DocxWFS_Parser_Docx
    • OdtWFS_Parser_Odt

Why

Ensures WP File Search does not collide with other plugins that define a Parser class in the global namespace, allowing coexistence without fatal errors.

Testing

  • Activated WP File Search alongside Ninja Forms → no fatal error
  • Verified PDF/DOCX/ODT indexing and searching still work

- Rename interface Parser → WFS_Parser
- Rename concrete parsers:
  - Pdf   → WFS_Parser_Pdf
  - Docx  → WFS_Parser_Docx
  - Odt   → WFS_Parser_Odt

This resolves a fatal error when WP File Search is activated
alongside plugins that also declare a global Parser class
(e.g. Ninja Forms)
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