[ZBX-4537] Using the Zabbix classes from another project impossible due to relative includes/requires Created: 2012 Jan 12 Updated: 2017 May 30 Resolved: 2012 Feb 25 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Frontend (F) |
Affects Version/s: | 1.9.9 (beta) |
Fix Version/s: | 2.0.0rc1 |
Type: | Incident report | Priority: | Minor |
Reporter: | Timo A. Hummel | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Description |
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:
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. |
Comments |
Comment by Pavels Jelisejevs (Inactive) [ 2012 Jan 16 ] |
We've decided to start added dirname(_FILE_) to our require paths from now on and added this to our guidelines, but the existing calls will be refactored over time. It's too much work to change it all at once. |
Comment by Alexei Vladishev [ 2012 Feb 25 ] |
It is documented under https://zabbix.org/wiki/Docs/specs/coding_style#Statement_formatting |
Comment by Alexei Vladishev [ 2012 Feb 25 ] |
Fixed in pre-1.9.10, revision 25606. It won't be integrated into 1.8.x. |