Error: arrayValue is deprecated. Use val instead
I have been using Vanilla Forums (open source v2.3.1) for a while. All of a sudden I started getting the error "arrayValue is deprecated. Use val instead" on my forum. After investigation, I figured that it was related to several plugins. I removed them one by one and it resolved the error. But I lost several features, which were provided by those plugins.
I absolutely did not change anything on my forum for a while. So I was wondering if anything else could have changed on the host's side (like PHP version perhaps?)
Some of the plugins that had the issue are - OnlineNow, UserList, TopPosters and Signatures.
==========================
858: trigger_error($message, E_USER_ERROR);
859: return;
860: }
861: }
862: trigger_error($message, E_USER_DEPRECATED);
863: }
864: }
865:
866: if (!function_exists('explodeTrim')) {
Backtrace:
/home/myhome/public_html/library/core/functions.general.phpPHP::Gdn_ErrorHandler();
[/home/myhome/public_html/library/core/functions.general.php:862] PHP::trigger_error();
[/home/myhome/public_html/library/core/functions.deprecated.php:76] PHP::deprecated();
[/home/myhome/public_html/plugins/TopPosters/default.php:67] PHP::arrayValue();
[/home/myhome/public_html/plugins/TopPosters/default.php:59] TopPostersPlugin->_AttachBadge();
[/home/myhome/public_html/library/core/class.pluginmanager.php:873] TopPostersPlugin->DiscussionController_CommentInfo_Handler();
[/home/myhome/public_html/library/core/class.pluginmanager.php:781] Gdn_PluginManager->callEventHandler();
[/home/myhome/public_html/library/core/class.pluggable.php:133] Gdn_PluginManager->callEventHandlers();
[/home/myhome/public_html/applications/vanilla/views/discussion/helper_functions.php:148] Gdn_Pluggable->fireEvent();
[/home/myhome/public_html/applications/vanilla/views/discussion/comments.php:19] PHP::writeComment();
[/home/myhome/public_html/applications/vanilla/views/discussion/index.php:53] PHP::include();
[/home/myhome/public_html/library/core/class.controller.php:713] PHP::include();
[/home/myhome/public_html/library/core/class.controller.php:1242] Gdn_Controller->fetchView();
[/home/myhome/public_html/library/core/class.pluggable.php:199] Gdn_Controller->xRender();
[/home/myhome/public_html/applications/vanilla/controllers/class.discussioncontroller.php:282] Gdn_Pluggable->__call();
[/home/myhome/public_html/applications/vanilla/controllers/class.discussioncontroller.php:282] DiscussionController->render();
[/home/myhome/public_html/applications/vanilla/controllers/class.discussioncontroller.php:282] DiscussionController->index();
[/home/myhome/public_html/library/core/class.dispatcher.php:326] PHP::call_user_func_array();
[/home/myhome/public_html/index.php:44] Gdn_Dispatcher->dispatch();
Variables in local scope:
[oldName] 'arrayValue'
[newName] 'val'
[date] ''
[message] 'arrayValue is deprecated. Use val instead.'
Need Help?
If you are a user of this website, you can report this message to a website administrator.
If you are an administrator of this website, you can get help at the Vanilla Community Forums.
Additional information for support personnel:
Application: Vanilla
Application Version: 2.3.1
PHP Version: 5.6.33
Operating System: Linux
Server Software: Apache
Referer: https://www.mydomain.com/
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
Controller: PHP
Method: trigger_error
Comments
could it be you turned on debugging in config.php
Set $Configuration['Debug'] = TRUE; in your conf/config.php to reveal full error messages. Remember to remove it when you are done. or
set $Configuration['Debug'] = FALSE; in your conf/config.php if you don't want to see warning messages.
if after turning off debug ....
the error you reported relates to TopPosters.
you might ask the question from the add-on (and from each add-on you see a problem.
https://open.vanillaforums.com/addon/topposters-plugin
As far as signatures - you could try github
and see if it works
https://github.com/vanilla/addons/tree/master/plugins/Signatures
as far as the other plugins try them individually and see if you have errors.
regarding deprecation and plugin changes....
if the plugin author doesn't change it and you want here is further info... you can see parameters and arguments needed for each functions.
deperecation info here...
https://github.com/vanilla/vanilla/search?q=arrayvalue&type=
the function prior to deprecation...
https://github.com/vanilla/vanilla/blob/Vanilla_2.1/library/core/functions.general.php#L214
the new function ...
https://github.com/vanilla/vanilla/blob/Vanilla_2.5/library/core/functions.compatibility.php#L399
Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.
@River - Thanks for your help.
I don't have the debug variable in my config.php, but I added it and set it to False. Let me clarify that these are not just warnings, but reported as "Fatal Error". I managed to resolve several of these errors by replacing the deprecated calls. However, I'm still not clear what triggered these errors all of a sudden. What has changed?
Currently I'm stuck at this error with the UserList plugin and will post it on a new thread for that plugin (per your suggestion):
Fatal Error in PHP.preg_match();
preg_match() expects parameter 2 to be string, array given
The error occurred on or near: /home/myhome/public_html/plugins/UserList/class.userlistmodule.php
54: public function ToString() {
55: $String = '';
56: $Session = Gdn::Session();
57: $permissions=$Session->User->Permissions;
58: $admin=preg_match('/Garden.Settings.Manage/',$permissions);
59:
60: ob_start();
61: $Limit = Gdn::Config('UserList.Limit');
62: $Photo = Gdn::Config('UserList.Photo');
Normally that shouldn't be errors but warnings. t could also be triggered by the PHP error level.
Check a) if you have
ini_set('display_errors', 0);
in your /index.php and b) if your hoster has any way to overrule your settings, maybe by a php.ini that has been altered somewhereThanks, @R_J
I worked with my host to turn off display_errors setting and can see both the local value and the master value set to "off" in mydomain.com/phpinfo.php .
I'm also getting another warning in a pop-up when saving drafts -
{ "Code": 16384, "Exception": "DraftModel->getCount(int) is deprecated. Use DraftModel->getCountByUser() instead.", "Class": "Gdn_ErrorException" }
The above warning is also discussed in the thread: https://open.vanillaforums.com/discussion/33009/strange-error-whit-2-3
But it talks about the same fix that you mentioned.
Is there anything else that I can check?
A quick update, if I remove my own php.ini, the errors are resolved. In the php.ini, display_errors = Off and error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT .
Is there anything else that I can check?
if you are saying everything works fine when you remove your php.ini you don't get errors.
and you are satisfied.
you can try this in your php.ini and see if it gives you desired results.
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR);
http://php.net/manual/en/errorfunc.constants.php
if you still have issues - you could experiment and see if things work properly if you remove
E_USER_ERROR. although leave it in if results are ok.
http://php.net/manual/en/function.ini-set.php
e.g. from link
http://php.net/manual/en/errorfunc.configuration.php#ini.display-errors
http://php.net/manual/en/function.error-reporting.php
https://open.vanillaforums.com/discussion/35687/vanilla-2-5-is-now-available
https://open.vanillaforums.com/discussion/35686/vanilla-will-end-php-5-6-support-in-2018
instead of banging your head on an old version of vanilla and old version of php.
Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.
is this what you have in your index.php?
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR);
regarding my last comment
rather use this with =
error_reporting = E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR
phpinfo should tell you your error reporting as it understands it the location of the php.ini files it reads.
you can use the values and total them to reflect what they are vs. what you think they are.
http://uk.php.net/manual/en/errorfunc.constants.php
https://stackoverflow.com/questions/3758418/numeric-values-of-error-reporting-levels
Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.
Things had been working fine without php.ini . But I still went ahead and upgraded to Vanilla 2.5.1 and PHP 7.2 without the php.ini . It continues to look good. Is there any strong reason to have a custom php.ini for which I should restore it back?
the only reason would be if you want to modify existing settings within your own .ini file.
Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.