doujiexin1136 2012-12-05 02:54
浏览 54
已采纳

奇怪的Zend Framework问题 - include_once正在寻找错误的文件夹

I've spent a lot of time troubleshooting this myself but none of what I've read solves my issue so I'm hoping I get some help here.

So anyway, I have written a PHP script that provides various functions to connect with Google Calendar. When I run this script directly using some inline test code to call my functions, everything runs fine. However, when I call the function from other scripts using 'require_once' to include it I get the following errors:

Warning: include_once(Zend\Gdata\Calendar\Extension\EventQuery.php) [function.include-once]: failed to open stream: No such file or directory in C:\Users\Luke Franklin\Clients\Tiers For Tea\Development\TiersForTea.com v1.1\lib\Zend\Loader.php on line 134
Warning: include_once() [function.include]: Failed opening 'Zend\Gdata\Calendar\Extension\EventQuery.php' for inclusion (include_path='.;C:\xampp\php\PEAR;C:\Users\Luke Franklin\Clients\Tiers For Tea\Development\TiersForTea.com v1.1\lib;C:\xampp\htdocs\TiersForTea.com\lib') in C:\Users\Luke Franklin\Clients\Tiers For Tea\Development\TiersForTea.com v1.1\lib\Zend\Loader.php on line 134

Your first thoughts might be that I'm not using the correct include path, but I have checked and rechecked this many times. I even tried hard coding the path. I'm quite sure that I'm using the correct path.

Now for the weird bit. If you look at the error you will notice the file Zend is trying to include: Zend\Gdata\Calendar\Extension\EventQuery.php. This file does not actually exist in the 'Extension' folder. It does exist in the parent folder though. If I just copy 'EventQuery.php' into the 'Extension' folder my script runs as expected. Weird, right?

So that does sorta solve my problem, but I would like to know what's going on here in-case it creates further issues. I should also note that I'm calling this script into an OpenCart module.

You might want to see some of my code so here's a snippet of the important bits, if you want more details just let me know:

<?php
set_include_path(get_include_path() . PATH_SEPARATOR . realpath('\\lib') . PATH_SEPARATOR . "C:\\xampp\\htdocs\\TiersForTea.com\\lib");
require_once('Zend/Loader.php');

function connect() {
    Zend_Loader::loadClass('Zend_Gdata');
    Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
    Zend_Loader::loadClass('Zend_Gdata_Calendar');
  • 写回答

1条回答 默认 最新

  • douyi4544 2012-12-05 03:27
    关注

    I doubt the error exists in any of the Zend files as you have indicated it works correctly in your isolation tests.

    The error is thrown from Zend_Loader which means something in your code is making reference to Zend_Gdata_Calendar_Extension_EventQuery.

    Check the stack trace for the error if available to pinpoint the location. If that's not available, do a global find for that string. If you find any matches, you will need to change them to Zend_Gdata_Calendar_EventQuery.

    Update

    Seems this is a known bug(s)

    It's an issue when your code registers an error handler using ErrorException. Apparently it's fixed in the 1.12 branch but hasn't made it to a release yet.

    There's a patch in the 11959 bug report that fixes the issue

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 ESP32怎么烧录自启动程序
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址
  • ¥15 elmos524.33 eeprom的读写问题
  • ¥15 使用Java milo连接Kepserver服务端报错?
  • ¥15 用ADS设计一款的射频功率放大器
  • ¥15 怎么求交点连线的理论解?
  • ¥20 软件开发方法学习来了
  • ¥15 微信小程序商城如何实现多商户收款 平台分润抽成