Sunday 18 December 2011 11:04:02 pm - 3 replies
Hi,
I used the «Pay-Per-Download» extension from Peter Keung with eZ Publish 4.3 and il worked well.
Now I've done an upgrade to eZ Publish 2011.11 I meet this error message:
Fatal error: Call to undefined function ezi18n() in /home/xxxxx/public_html/extension/payperdownload/eventtypes/event/payperdownload/payperdownloadtype.php on line 8 Fatal error: eZ Publish did not finish its request The execution of eZ Publish was abruptly ended, debug information can be found in the log files normally placed in var/log/* or by enabling 'DebugOutput'
The line 8 of payperdownloadtype.php is:
6 public function __construct() 7 { 8 parent::__construct( self::WORKFLOW_TYPE_STRING, ezi18n( 'kernel/workflow/event', 'Pay Per Download' ) ); 9 $this->setTriggerTypes( array( 'shop' => array( 'checkout' => array( 'before' ) ) ) ); 10 }
and there is no specifics logs in /var/log/error.log
These error lines are displayed, for example, each time I click on the link «Trigger» in the left menu of the Setup tab.
Any help is welcome.
Pascal
Sunday 18 December 2011 11:22:37 pm
Hello Pascal,
Remember that the 'ezi18n' function was deprecated and removed in eZ Publish 4.3 (I seem to remember).
https://github.com/ezsystems/ezpublish/blob/master/doc/bc/4.3/changes-4.3.0.txt
Quote from above link ...
ezi18n() and ezx18n() functions has been deprecated in favor of new ezpI18n::tr() function that takes advantage of autoloading so you don't need to require_once the i18n.php file. These two function will be removed in a future version.
So it's important to remember from 4.3+ you should use 'ezpI18n::tr()' function instead within your custom workflow event and other extension PHP code.
This was also commented on in the doc.ez.no site content, http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Libraries/ezi18n
And some have used creative solutions to avoid using the new syntax, though while I do share this information also I strongly urge to use the new syntax instead of trying to retain the older syntax.
http://share.ez.no/forums/developer/please-bring-back-ezi18n
We are now several years away from this code being deprecated and removed from eZ Publish entirely. Best to update your code to support the latest community build available!
You'll need to edit your copy of the workflow event in question and and make these PHP code changes yourself, though this by it'self is not hard to do or very time consuming. Best wishes!
I hope this helps ...
Cheers,
Heath
Modified on Sunday 18 December 2011 11:28:01 pm by Heath
Monday 19 December 2011 11:10:17 pm
Thanks a lot Heath !
Your explanations are clear and the solution seems to be what you suggest: replace "ezi18n" by "ezpI18n::tr".
I did it in payperdownloadtype.php (which is the only place of the extension where "ezi18n" is used), I activated the extension and reloaded the autoload table. As a result, no more error message when I click on «Tiggers» in the Setup tab.
I tested the operation of the extension and it works fine
Regards,
Pascal
You must be logged in to post messages in this topic!