Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-4537

Using the Zabbix classes from another project impossible due to relative includes/requires

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.0.0rc1
    • 1.9.9 (beta)
    • Frontend (F)
    • None

      When attempting to use the Zabbix classes from another project, this is currently not possible because the includes are relative.

      A possible workaround would be to chdir() to the zabbix root directory, but this is not a clean method.

      There are several methods:

      • Rewrite the require/includes using _DIR_ (or dirname(_FILE_) for backwards compatibility) - not nice, but it would work. Drawback is that one would need to change all the occurences in case of a chance
      • Add a dedicated require/include method which automatically uses _DIR_ to find out the absolute path, something like this (untested):

      function zbx_require_once ($file)

      { // Additional checks if the include really exists would need to go here // Also, the following line would need to be adjusted whereever the zbx_require_once function lives require_once(dirname(__FILE__) . $file); }

      I'm open for discussion for a possible bugfix, which I could eventually write.

            Unassigned Unassigned
            felicitus Timo A. Hummel
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: