Christophe Posted March 10, 2018 Share Posted March 10, 2018 (edited) Hello, I've just upgraded a website from 2.8.62 to 3.0.62. In the backend everything seems fine. But, when connected, I now see this message on the frontend (Debug mode On + Tracy Debugger): Error Call to undefined function _x(), did you mean _()? File: /home/.../www/site/templates/_head.php:2 1: <!DOCTYPE html> 2: <html lang="<?php echo _x('fr', 'HTML language code'); ?>"> And an Error 500 message when not connected to the backend. Precision: only the French language is currently activated. Any idea(s)? (What other information do you need?) Edited March 10, 2018 by Christophe Link to comment Share on other sites More sharing options...
Christophe Posted March 10, 2018 Author Share Posted March 10, 2018 (edited) [Update] I also have an error message when accessing any module page in the backend: Warning count(): Parameter must be an array or an object that implements Countable File: .../Inputfield/InputfieldFile/InputfieldFile.module:513 503: return $out; 504: } 505: 506: public function renderReady(Inputfield $parent = null, $renderValueMode = false) { 507: $this->addClass('InputfieldNoFocus', 'wrapClass'); 508: return parent::renderReady($parent, $renderValueMode); 509: } 510: 511: public function ___render() { 512: if(!$this->extensions) $this->error($this->_('No file extensions are defined for this field.')); 513: $numItems = count($this->value); 514: if($this->allowCollapsedItems()) $this->addClass('InputfieldItemListCollapse', 'wrapClass'); 515: if($numItems == 0) { 516: $this->addClass('InputfieldFileEmpty', 'wrapClass'); 517: } else if($numItems == 1) { Edited March 10, 2018 by Christophe Link to comment Share on other sites More sharing options...
matjazp Posted March 10, 2018 Share Posted March 10, 2018 14 minutes ago, Christophe said: Warning count(): Parameter must be an array or an object that implements Countable File: .../Inputfield/InputfieldFile/InputfieldFile.module:513 Downgrade php, install the latest dev or wait a week or so for the next master. 1 Link to comment Share on other sites More sharing options...
Christophe Posted March 10, 2018 Author Share Posted March 10, 2018 Good idea :). After seeing the problem, I upgraded from PHP 5.6 to PHP 7.2. Same thing. I'm keeping it at 7.2 for the moment. I'm reverting back to 2.8.62. It should be easy, I still have the renamed old folder and files. I'll wait and try again. Link to comment Share on other sites More sharing options...
Christophe Posted March 10, 2018 Author Share Posted March 10, 2018 (edited) I've reverted back to PHP 5.6, in case. I've put everything back as it was before, and I've removed the namespace lines where I had added them. I've cleaned the site/assets/cache/ folder again. Now I can't login, everywhere (frontend and backend) I see: Notice Array to string conversion File: .../LanguageSupport/FieldtypeTextLanguage.module:83 73: /** 74: * Format value for output, basically typecasting to a string and sending to textformatters from FieldtypeText 75: * 76: * @param Page $page 77: * @param Field $field 78: * @param LanguagesValueInterface|string $value 79: * @return string 80: * 81: */ 82: public function formatValue(Page $page, Field $field, $value) { 83: return parent::formatValue($page, $field, (string) $value); 84: } 85: 86: /** 87: * Given a value, return an portable version of it as array I'm going to try to revert back (files and database) directly with the help of the hoster's tools. I should have gone to bed. Edited March 10, 2018 by Christophe Link to comment Share on other sites More sharing options...
matjazp Posted March 10, 2018 Share Posted March 10, 2018 @Christophe count() warning is coming from php 7.2, but you won't get this warning if you upgrade to the latest dev and you can keep php 7.2. Not sure why you get array to string conversion notice... 1 Link to comment Share on other sites More sharing options...
Christophe Posted March 10, 2018 Author Share Posted March 10, 2018 (edited) I have to go to bed, I haven't slept at all. I've reverted back to more or less day-1files fetching them via a snap-0 (just after midnight) sftp connection, but perhaps it's not far enough. I've tried to revert back to a day-1 database, but I had an error message from within the hosting's Manager (and I couldn't connect to it from PHPMyAdmin). I have this on the login page: Error: Call to a member function setLanguageValue() on array (line 43 of /home/.../www/wire/modules/LanguageSupport/FieldtypeTextLanguage.module) when Debug mode is true, (when Debug mode is false: The server encountered an internal error or misconfiguration and was unable to complete your request.) and this also: Server Error We're sorry! The server encountered an internal error and was unable to complete your request. Please try again later. error 500 | 10. 3. 2018 09:10 and the Server Error message appears alone on the homepage, for example. I've written to the hosting company to know if they had/have problems. Perhaps I'll have to revert a few days back (not really a big problem). Edit: if the database and the files aren't of the same day exactly could it be a problem? Should I remove the Tracy Debugger module manually via sftp? Edited March 10, 2018 by Christophe Link to comment Share on other sites More sharing options...
Christophe Posted March 10, 2018 Author Share Posted March 10, 2018 (edited) Hello, It seems fine again. Like before my attempt at upgrading to version 3 (because I could need the LOGIN/REGISTER/PROFILE module in the near future). Perhaps it was related to the PHP environment, to a Let's Encrypt certificate automatic regeneration... and I had to wait a little for some cache cleaning on the server side. And it seems also that they had some network issues at the same time... Edited March 10, 2018 by Christophe Link to comment Share on other sites More sharing options...
Christophe Posted March 10, 2018 Author Share Posted March 10, 2018 (edited) As I've just put back my user account's backend to French, I'm wondering if the fact that I put it at one point in English is a little bit related (but it shouldn't). But I don't remember when exactly I did it. I'll take a look at the results with site:processwire.com/talk/ "Call to undefined function _x()" in Google. Edited March 10, 2018 by Christophe Link to comment Share on other sites More sharing options...
Christophe Posted March 20, 2018 Author Share Posted March 20, 2018 (edited) I've just tested again by upgrading to version 3 on another server. To ProcessWire 3.0.96 (Master) this time. I've had again messages like Error - Call to undefined function _x(), did you mean _()?. It seems that using $this->_ instead of __ works. But I've kept __ and have used the following instead depending on the template file/case: <?php namespace ProcessWire; <?php namespace ProcessWire; ?> <?php namespace ProcessWire; include('./_head.php'); // include header markup ?> This time I've just put it on one line, inside the same pair of tags, I've not separated the namespace part and the include part. By the way, on this server, I have been able to upgrade thanks to the Upgrades module. On the other one I cannot have access to the ProcessWire core updates/upgrades anymore. Edited March 21, 2018 by Christophe Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now