Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with Gii's diff #2

Open
rcoelho opened this issue Aug 19, 2012 · 4 comments
Open

Incompatibility with Gii's diff #2

rcoelho opened this issue Aug 19, 2012 · 4 comments
Assignees

Comments

@rcoelho
Copy link

rcoelho commented Aug 19, 2012

framework/gii/components/TextDiff.php lines 6-8 have require_once that don't work when the extension is activated.

@cebe
Copy link
Member

cebe commented Aug 19, 2012

can you explain what you mean with don't work? I haven't seen any problems with gii and zend autoloader myself.

@rcoelho
Copy link
Author

rcoelho commented Aug 19, 2012

Sure. The code is generated without problems. But if you click in the "diff" link in Gii, there's a PHP error:
require_once(Text/Diff.php): failed to open stream: No such file or directory (/.../framework/gii/components/TextDiff.php:6)

@ghost ghost assigned cebe Aug 22, 2012
@hshyk
Copy link

hshyk commented Apr 29, 2014

This might be old, but I just ran into this issue. I found two possible ways to fix this issue:

  1. Add the following to your main.php config file 'system.gii.components.Pear.*'. I recommend disabling the line in production if you are not going use the TextDiff class.
// autoloading model and component classes
'import'=>array(
   'application.models.*',
   'application.components.*',
   'system.gii.components.Pear.*'
),

OR

  1. Copy the gii/components/Pear/Text folder directly into your components folder. This method is good if you want to override the way that the TextDiff functionality works.

@alotacents
Copy link

I just ran into this I know this post is old would like to clarify the problem. The setting of param append = true on Yii::registerAutoloader function sets YiiBase::enableIncludePath = false which is used for Yii's autoloader. With YiiBase::enableIncludePath = false the import of gii.components.Pear.* is not found.

so to fix the issue just remove the append param from Yii::registerAutoloader and the problem is fixed.
I also changed this part of the code to match prefix
if(strpos($className, $prefix.'') !== false)
if(strpos($className, $prefix.'
') === 0)

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

No branches or pull requests

4 participants