eZ Community » Forums » General » Fatal error: Class 'ezpI18n' not...
expandshrink

Fatal error: Class 'ezpI18n' not found (recaptcha extension)

Fatal error: Class 'ezpI18n' not found (recaptcha extension)

Thursday 19 February 2015 2:20:24 am - 12 replies

I am using Ezpublish 4.1.3 and have recently installed the recaptcha extension to stop spammers.
https://github.com/brucem/ezpublish-recaptcha

It is on 2 live and a 1 test servers. 

 It works well, on all three, but if I put in the wrong captcha code I get the following responses on the two different kinds of servers.

 Live server
=============
Fatal error: eZ Publish did not finish its request
The execution of eZ Publish was abruptly ended, the debug output is present below.  (nothing there)
==============

Test servers
===================
Fatal error: Class 'ezpI18n' not found in /opt/local/httpd-2.2.25/htdocs/ezpublish-4.1.3/extension/recaptcha/datatypes/recaptcha/recaptchatype.php on line 69
Fatal error: eZ Publish did not finish its request
The execution of eZ Publish was abruptly ended, the debug output is present below.
==================

There are no errors in the ezpublish/var/log files
The line referred to in the error message from the test server shows the following:
====================
$objectAttribute->setValidationError(ezpI18n::tr( 'extension/recaptcha', "The reCAPTCHA wasn't entered correctly. Please try again."blunk.gif Emoticon);
====================

In the feedback form class the only boxes I have ticked are 
"Required" and
"Information collector" 

I am clearing ini and template caches and regenerating the arrays after I try different things, and I also found that any template changes do not work until that form is re-edited and republished. 

Does anyone have any ideas?
I haven't done anything clever, just doing it "bog-standard" .

Cheers
Jeff 

Thursday 19 February 2015 3:15:23 am

I made a lib directory under an extension, added this file, ran ezpgenerateautoloads and it worked fine.

<?php
Class Utils { 
  function ezi18n( $context, $source, $comment = null, $arguments = null ) {
     return ezpI18n::tr( $context, $source, $comment, $arguments ); 
  }
}

Code source: http://share.ez.no/forums/developer/please-bring-back-ezi18n

Modified on Thursday 19 February 2015 3:16:29 am by Betsy Gamrat

Thursday 19 February 2015 3:50:15 am

Quote from Betsy Gamrat :

I made a lib directory under an extension, added this file, ran ezpgenerateautoloads and it worked fine.

<?php
Class Utils { 
  function ezi18n( $context, $source, $comment = null, $arguments = null ) {
     return ezpI18n::tr( $context, $source, $comment, $arguments ); 
  }
}

Code source: http://share.ez.no/forums/developer/please-bring-back-ezi18n

Wow! Your a peach Betsy. I will give that a crack : )
Thanks
Jeff 

Thursday 19 February 2015 12:09:41 pm

Hello Folks!

I think that Betsy's suggestion would not work for cousin mosquito's actual use case.

In cousin's situation I think the real solution will be to do the exact opposite as Betsy suggests as eZ Publish 4.1.3 does not contain the 'ezpI18n' class which means her solution would not be used and the errors would remain. This class and method name was not renamed until eZ Publish 4.3.

Betsy's solution would work for situations where say custom extensions still called the deprecated and now removed 'ezi18n' function ... I think, I've not tested her solution myself. The original implementation was a nasty include based pure php function and I'm not certain that a class based solution would work the same. Thankfully ezp moved to wipe out the awful include based classless function usage in later versions.

My first suggestion would be to encourage an upgrade to a more recent version of eZ Publish as the extension recaptcha requires the apis of a version of eZ Publish greater than eZ Publish 4.3+

My other quick suggestion would be to simply create a custom extension like bcezpi18ncompat, create a lib directory within the extension, download the following file into the lib directory, re-generate autoloads and clear all caches. You should not need to activate this extension via settings, just re-generate autoloads.

https://github.com/ezsystems/ezpublish-legacy/blob/master/kernel/common/ezpi18n.php

If you upgrade to eZ Publish 4.3 or later you will not need this bcezpi18ncompat extension solution and you should remove the extension and re-generate autoloads.

This quick solution would provide a current copy of the class and method names required by recaptcha extension.

The above solution is very use case and version specific due to the api changes from version to version of eZ Publish. Different use cases and versions of eZ Publish might require slightly different solutions due to repeated api dependency changes.
Here is the related issue ticket: https://jira.ez.no/browse/EZP-16160

For those interested the history of this class is insightful: https://github.com/ezsystems/ezpu...its/master/kernel/common/ezpi18n.php

I hope this helps!

Cheers,
Heath 

Modified on Thursday 19 February 2015 12:11:51 pm by // Heath

Thursday 19 February 2015 8:19:55 pm

Quote from // Heath :

Hello Folks!

I think that Betsy's suggestion would not work for cousin mosquito's actual use case.

In cousin's situation I think the real solution will be to do the exact opposite as Betsy suggests as eZ Publish 4.1.3 does not contain the 'ezpI18n' class which means her solution would not be used and the errors would remain. This class and method name was not renamed until eZ Publish 4.3.

Betsy's solution would work for situations where say custom extensions still called the deprecated and now removed 'ezi18n' function ... I think, I've not tested her solution myself. The original implementation was a nasty include based pure php function and I'm not certain that a class based solution would work the same. Thankfully ezp moved to wipe out the awful include based classless function usage in later versions.

My first suggestion would be to encourage an upgrade to a more recent version of eZ Publish as the extension recaptcha requires the apis of a version of eZ Publish greater than eZ Publish 4.3+

My other quick suggestion would be to simply create a custom extension like bcezpi18ncompat, create a lib directory within the extension, download the following file into the lib directory, re-generate autoloads and clear all caches. You should not need to activate this extension via settings, just re-generate autoloads.

https://github.com/ezsystems/ezpublish-legacy/blob/master/kernel/common/ezpi18n.php

If you upgrade to eZ Publish 4.3 or later you will not need this bcezpi18ncompat extension solution and you should remove the extension and re-generate autoloads.

This quick solution would provide a current copy of the class and method names required by recaptcha extension.

The above solution is very use case and version specific due to the api changes from version to version of eZ Publish. Different use cases and versions of eZ Publish might require slightly different solutions due to repeated api dependency changes.
Here is the related issue ticket: https://jira.ez.no/browse/EZP-16160

For those interested the history of this class is insightful: https://github.com/ezsystems/ezpu...its/master/kernel/common/ezpi18n.php

I hope this helps!

Cheers,
Heath 

Thanks for the feedback. I tried to contact the person who wrote the extension to check that it was still valid but got no response. A trial upgrade to 4.8 (or therabouts) is done, but these things take time to fully implement, and I need spam protection now.

Thursday 19 February 2015 8:42:48 pm

Hello cousin,

I think you miss-understand me. The extension while not as actively maintained is still currently compatible with the latest eZ Publish Legacy APIs. However your eZ Publish 4.1.3 is using older APIs.

In short his extension code is current, your eZ Publish install is not.

The real problem is with your install not his extension.

Bruce is a good man! He's done a good job with his extension. But even the very best eZ Publish extension developers should not be expected to support deprecated releases of a software product / and it's apis with extension releases to support deprecated apis.

Extension developers need to keep their latest releases compatible with the latest release of eZ Publish Legacy (even this can be hard to get at times in the eZ Community).

My 'quick solution' (as described in detail above) provides for the php class you are missing and need today to solve the verbose errors in dev/testing and the white screen of death errors your having in production. 

Please do try the solution I've recommended. It is a quick and simple solution to the problem your having.

I hope this helps!

Cheers,
Heath

Modified on Thursday 19 February 2015 8:46:00 pm by // Heath

Thursday 19 February 2015 9:10:47 pm

Quote from // Heath :

Hello cousin,

I think you miss-understand me. The extension while not as actively maintained is still currently compatible with the latest eZ Publish Legacy APIs. However your eZ Publish 4.1.3 is using older APIs.

In short his extension code is current, your eZ Publish install is not.

The real problem is with your install not his extension.

Bruce is a good man! He's done a good job with his extension. But even the very best eZ Publish extension developers should not be expected to support deprecated releases of a software product / and it's apis with extension releases to support deprecated apis.

Extension developers need to keep their latest releases compatible with the latest release of eZ Publish Legacy (even this can be hard to get at times in the eZ Community).

My 'quick solution' (as described in detail above) provides for the php class you are missing and need today to solve the verbose errors in dev/testing and the white screen of death errors your having in production. 

Please do try the solution I've recommended. It is a quick and simple solution to the problem your having.

I hope this helps!

Cheers,
Heath

I understood you fully Heath. I just wanted to check that the extension was still valid for older versions like mine before I committed to it, as I am not a programmer. I agree, anyone that writes extensions deserves a medal. I probably don't have the skills to apply your solution but will give it a crack. Stand by for some dumb questions.
Thanks again.
Jeff 

Friday 20 February 2015 3:37:23 am

Quote from // Heath :

In cousin's situation I think the real solution will be to do the exact opposite as Betsy suggests as eZ Publish 4.1.3 does not contain the 'ezpI18n' class which means her solution would not be used and the errors would remain. This class and method name was not renamed until eZ Publish 4.3.

Hi Heath,
if ezpublish 4.1.3 DID contain the ezpl18n class, where would it live ?

Would it be here?
/opt/local/httpd-2.2.25/htdocs/ezpublish-4.1.3/kernel/common 

If I copied ezpi18n.php from a later edition (4.5) to this folder:
/opt/local/httpd-2.2.25/htdocs/ezpublish-4.1.3/kernel/common

... and referenced it, where would I reference it from?

Is this what  David Wirth has done here (bottom post)?
http://share.ez.no/forums/developer/please-bring-back-ezi18n

He says:

>> Nevermind, it's done. I just added the ezpi18n class file and then
>> included it where it was needed, problem solved.

For me the trick is to know where to reference it from.

I don't know what "bcezpi18ncompat" is and neither does google.
I also don't know how to build extensions, and I wouldn't have thought I should, but I also know that's not how it works with Ez : )

Thanks for your help so far.
Jeff 

Friday 20 February 2015 6:48:16 am

Hello cousin,

The php class file required does -not- exist in eZ Publish 4.3.

What you suggested to do is called kernel hacking and is strongly frowned upon. You should not do what you suggested. That would be the wrong way to try (and fail) to solve the problem your having.

What David Wirth suggested was actually solving a similar but -different- problem. What he did you should not do as it will not solve your problem.

You say, "For me the trick is to know where to reference it from" but the real problem is that you -do not- need to 'reference' it from -anywhere- at all. That would only be required in eZ Publish 3.x not eZ Publish 4.x+ (respectively) as a new solution called 'autoloads' is used in eZ Publish 4.x+ which means no more 'references' to maintain (per-say).

Please do this to solve your error, this is the quick solution I described briefly above in much greater detail.

All you need to do is the following, it's so simple you could give a child a free donut and they could do it for you.

  • Navigate into the base eZ Publish folder
  • Navigate into the 'extension' directory within the eZ Publish folder
  • Create a new folder called:  bcezpi18ncompat
  • Navigate into the 'bcezpi18ncompat' directory
  • Create a new folder called:  lib
  • Download this file and copy it into the 'lib' directory: https://raw.githubusercontent.com/ezsystems/ezpublish-legacy/master/kernel/common/ezpi18n.php
  • Navigate (back) to the base eZ Publish folder
  • Regenerate autoloads by running the following terminal command:  php ./bin/php/ezpgenerateautoloads.php
  • Clear all caches
  • Reload the web page
  • Repeat the process of website use which generated the errors in the past

Smile that the errors are now solved, enjoy a tall glass of orange juice while you step outside and enjoy the sun for a few minutes in triumph happy.gif Emoticon

Note: 'bcezpi18ncompat' was a directory name which explains what the extension is/does. It does not exist in google. I created the name specifically for this purpose to help you solve this problem. If this is too much for you to bear, I'm sorry, it makes solid sense to a developer of eZ Publish. If you feel you must you can use another folder name as the name of the folder (almost) does not matter (with some more technical limitations).

You may not be a developer but you don't really have to be one to solve the problem your having. You may not know how to build extensions, but to solve your problem you don't really need to know how to build extensions to solve the problem your having.

You say, 'I also don't know how to build extensions, and I wouldn't have thought I should, but I also know that's not how it works with Ez' but you would not have this problem if you had A) upgraded to at least eZ Publish 4.3 (kept your website running the latest stable release of eZ Publish and not let your website fall behind) and or B) not needed to use an extension which required only one eZ Publish 4.3 api (the refactored built-in text translation api) not found in eZ Publish 4.1.3.

I've clearly written out the steps in the most non-technical wording possible. Almost any user of computers should be able to understand them, follow them and solve this problem regardless of previous experience. I'm trying really hard here to help you cousin.

If you absolutely need specific commands for each step I can write those if you share the Operating System your using but anything I could write further would still be incomplete as the paths to the eZ Publish folder on disk are variable and could be anywhere on disk and I would not know in advance.

Also if your using windows some helpful command line tools that I would use in linux or unix os usage example instructions to help automate the process / simplify it would not be available meaning manually using windows explorer would be the simplest way and my instructions above already are written in terms that would work for windows anyway.

And if you really really don't want to do any work at all, give me till Monday, i'll create and publish the bcezpi18ncompat eZ Publish extension I am describing and publish it on GitHub for you to just download, though you would still have to run terminal commands to install it and use it so ... come on man ... please .. just do the work so clearly described above so I don't have to spend my weekend creating an almost valueless extension (to almost every other user who has already done the right thing and upgraded).

Apologies in advance if I seem frustrated, it's late and I have to get up very early tomorrow. I never really stop working :P

I hope this helps!

Cheers,
Heath

Modified on Friday 20 February 2015 6:53:08 am by // Heath

Friday 20 February 2015 12:45:17 pm

Quote from // Heath :

Hello cousin,

The php class file required does -not- exist in eZ Publish 4.3.

What you suggested to do is called kernel hacking and is strongly frowned upon. You should not do what you suggested. That would be the wrong way to try (and fail) to solve the problem your having.

What David Wirth suggested was actually solving a similar but -different- problem. What he did you should not do as it will not solve your problem.

You say, "For me the trick is to know where to reference it from" but the real problem is that you -do not- need to 'reference' it from -anywhere- at all. That would only be required in eZ Publish 3.x not eZ Publish 4.x+ (respectively) as a new solution called 'autoloads' is used in eZ Publish 4.x+ which means no more 'references' to maintain (per-say).

Please do this to solve your error, this is the quick solution I described briefly above in much greater detail.

All you need to do is the following, it's so simple you could give a child a free donut and they could do it for you.

  • Navigate into the base eZ Publish folder
  • Navigate into the 'extension' directory within the eZ Publish folder
  • Create a new folder called:  bcezpi18ncompat
  • Navigate into the 'bcezpi18ncompat' directory
  • Create a new folder called:  lib
  • Download this file and copy it into the 'lib' directory: https://raw.githubusercontent.com/ezsystems/ezpublish-legacy/master/kernel/common/ezpi18n.php
  • Navigate (back) to the base eZ Publish folder
  • Regenerate autoloads by running the following terminal command:  php ./bin/php/ezpgenerateautoloads.php
  • Clear all caches
  • Reload the web page
  • Repeat the process of website use which generated the errors in the past

Smile that the errors are now solved, enjoy a tall glass of orange juice while you step outside and enjoy the sun for a few minutes in triumph happy.gif Emoticon

Note: 'bcezpi18ncompat' was a directory name which explains what the extension is/does. It does not exist in google. I created the name specifically for this purpose to help you solve this problem. If this is too much for you to bear, I'm sorry, it makes solid sense to a developer of eZ Publish. If you feel you must you can use another folder name as the name of the folder (almost) does not matter (with some more technical limitations).

You may not be a developer but you don't really have to be one to solve the problem your having. You may not know how to build extensions, but to solve your problem you don't really need to know how to build extensions to solve the problem your having.

You say, 'I also don't know how to build extensions, and I wouldn't have thought I should, but I also know that's not how it works with Ez' but you would not have this problem if you had A) upgraded to at least eZ Publish 4.3 (kept your website running the latest stable release of eZ Publish and not let your website fall behind) and or B) not needed to use an extension which required only one eZ Publish 4.3 api (the refactored built-in text translation api) not found in eZ Publish 4.1.3.

I've clearly written out the steps in the most non-technical wording possible. Almost any user of computers should be able to understand them, follow them and solve this problem regardless of previous experience. I'm trying really hard here to help you cousin.

If you absolutely need specific commands for each step I can write those if you share the Operating System your using but anything I could write further would still be incomplete as the paths to the eZ Publish folder on disk are variable and could be anywhere on disk and I would not know in advance.

Also if your using windows some helpful command line tools that I would use in linux or unix os usage example instructions to help automate the process / simplify it would not be available meaning manually using windows explorer would be the simplest way and my instructions above already are written in terms that would work for windows anyway.

And if you really really don't want to do any work at all, give me till Monday, i'll create and publish the bcezpi18ncompat eZ Publish extension I am describing and publish it on GitHub for you to just download, though you would still have to run terminal commands to install it and use it so ... come on man ... please .. just do the work so clearly described above so I don't have to spend my weekend creating an almost valueless extension (to almost every other user who has already done the right thing and upgraded).

Apologies in advance if I seem frustrated, it's late and I have to get up very early tomorrow. I never really stop working :P

I hope this helps!

Cheers,
Heath

Now that is useful ! Thank you Heath. I will call the folder (EXTENSION)  heathsdoughnut to remind me of the help I received from you. As you say it is very simple, when I understand that there is no such thing as "bcezpi18ncompat" and that it is just a folder within a folder with a download in it.

Yes, I know, 4.1.3 is so last year, but there is only so much time I can afford to spend on trying to upgrade versions, hence I gave up after about 3 weeks of solid trying to advance one version and paid for someone else to upgrade to 4.9 on one of my 4 test servers. I have 2500 pages and 4 sites to look after so I cant spend the whole time on upgrades that constantly fail. 

I am very excited about trying your fix. I may even do it from home on the CLI.
Your instruction is very good. 

Will let you know how it goes!~ 

Thanks again
jeff 

Friday 20 February 2015 1:18:56 pm

My apologies for posting in error.  I am glad it has been sorted out.

Saturday 21 February 2015 6:03:55 pm

Hello cousin,

I'm glad my instructions are clear and you are able to understand what I've been trying to share happy.gif Emoticon

I look forward to hearing how things work out.

@Betsy - No worries on the confusion. It's always great to see you helping out in the forums, you always have great ideas and simple solutions.

Best wishes!

Cheers,
Heath

Friday 27 February 2015 12:47:44 pm

This has been a great help. Thanks mate!

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from