Deprecated: Non-static method SmartyPaginate::connect() should not be called statically - smarty

I am using SmartyPaginate plugin for SMARTY Template and its throwing 6-7 errors of same type from this very plugin. All error came up when I upgraded to PHP 7. Although I can disable error showing but I would really like to resolve that permanently.
Deprecated: Non-static method SmartyPaginate::getCurrentIndex() should not be called statically in libs\plugins\function.paginate_prev.php on line 58
Codes that are throwing errors.
if (SmartyPaginate::getCurrentIndex($_id) === false) {
$smarty->trigger_error("paginate_prev: total was not set");
return;
}

I resolved all the static errors. I did with following solutions.
Old Code
if (SmartyPaginate::getCurrentIndex($_id) === false) {
$smarty->trigger_error("paginate_prev: total was not set");
return;
}
New Code
if ((new SmartyPaginate)->getCurrentIndex($_id) === false) {
$smarty->trigger_error("paginate_next: total was not set");
return;
}

Related

How to find the tag from the error: Trying to update non-existent view with tag 85273 in React Native Android

In production of React Native app get the error on Android from crashlytics of firebase:
Fatal exception: com.facebook.react.uimanager.IllegalViewOperationException.
Trying to update non-existent view with tag 85273.
And there is no scenario of the crash, therefore it is not possible to detect it. I checked many times on emulators and a real Android device.
What did we find out about this crash?
the updateView method that caused the exception is located in node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java; 
public void updateView(int tag, String className, ReadableMap props) {
ViewManager viewManager = mViewManagers.get(className);
if (viewManager == null) {
throw new IllegalViewOperationException("Got unknown view type: " + className);
}
ReactShadowNode cssNode = mShadowNodeRegistry.getNode(tag);
if (cssNode == null) {
throw new IllegalViewOperationException("Trying to update non-existent view with tag " + tag);
}
if (props != null) {
ReactStylesDiffMap styles = new ReactStylesDiffMap(props);
cssNode.updateProperties(styles);
handleUpdateView(cssNode, className, styles);
}
}
by condition if cssNode == null, then throw an exception, it means some null came from the JS side;
ShadowNodeRegistry is a simple container class to keep track of ReactShadowNodes associated with a particular UIManagerModule instance;
and we have the number of the tag 85273, the cause of the exception.
How can I find the element in JS side by tag number 85273? Or maybe somebody could recommend me please some articles or share your experience how to solve like this crashes in Android of React Native app. Thanks in advance.

Server Migration fatal error on contact forms in CodeIgniter

I've been trying to pick my way through this error but I feel like I'm getting nowhere.
We're in the process of migrating a website from one server to another. All pages seem to work on the new site except for the contact form pages which appear to be trying to use 'form_helper.php'. These pages work correctly on the old server but not on the new one. I get an error of:
Fatal error: Call to undefined method CI_Loader::is_loaded() in C:\DATA\XXXX.com\www\application\helpers\form_helper.php on line 1038
Line 1038 of form_helper.php has the following on it:
if (FALSE !== ($object = $CI->load->is_loaded('form_validation')))
Any ideas would be GREATLY appreciated as I'm not that familiar with CodeIgniter.
Thanks in advance...
EDIT:
So I've worked out how to seemingly fix it... If I comment out the following code in the form_helper file, the page loads with no error:
/*if (FALSE !== ($object = $CI->load->is_loaded('form_validation')))
{
if ( ! isset($CI->$object) OR ! is_object($CI->$object))
{
return $return;
}
return $CI->$object;
}*/
Is this a bad idea? The full function now looks like this:
if ( ! function_exists('_get_validation_object'))
{
function &_get_validation_object()
{
$CI =& get_instance();
// We set this as a variable since we're returning by reference.
$return = FALSE;
/*if (FALSE !== ($object = $CI->load->is_loaded('form_validation')))
{
if ( ! isset($CI->$object) OR ! is_object($CI->$object))
{
return $return;
}
return $CI->$object;
}*/
return $return;
}
}
Make sure you have moved any array values in application/config/autoload.php from $autoload[‘plugins’] to $autoload[‘helpers’] or you will notice stuff break.
is_loaded() function is defined in Code/common.php Make sure the function is in right place.

laravel-3 core exception on new installation

I have a new installation of Laravel on a machine running ubuntu 12.04 LTS, Nginx, php-cgi, and Laravel v3.2.14
I am getting the following error.
Unhandled Exception
Message:
Undefined index: argv
Location:
DOCUMNET ROOT/laravel/core.php on line 218
EDIT:
I have managed to get a slightly more descriptive error by commenting out the error handling function in laravel //Error::shutdown(); on line 50 of DOCUMENT ROOT/laravel/laravel.php
Note that this line does not cause the error, it only seems to register a handler for the code that does.
Here is the error:
Unhandled Exception
Message:
A driver must be set before using the session.
Location:
DOCUMENT ROOT/laravel/session.php on line 109
Stack Trace:
DOCUMENT ROOT/laravel/session.php(150): Laravel\Session::instance()
DOCUMENT ROOT/laravel/laravel.php(195):
Laravel\Session::__callStatic('save', Array)
DOCUMENT ROOT/laravel/laravel.php(195): Laravel\Session::save()
DOCUMENT ROOT/public/index.php(34): require('/mona/developme...')
{main}
These are the code blocks causing the error:
if (Config::get('session.driver') !== '')
{
Session::save();
}
Which calls this function in DOCUMENT ROOT/laravel/session.php
public static function __callStatic($method, $parameters)
{
return call_user_func_array(array(static::instance(), $method), $parameters);
}
$method contains the string 'save', and $parameters is an empty array.
Laravel thinks that it is being accessed by cli if you are using php-cgi.
The solution is Modifying DOCUMENT ROOT/laravel/request.php like this:
public static function cli()
{
// This is a hack to make laravel work with fast-cgi
// Added by David - 03/27/13
if(!array_key_exists('argv', $_SERVER)) return false;
return defined('STDIN') || (substr(PHP_SAPI, 0, 3) == 'cgi' && getenv('TERM'));
}
Checking if the $_SERVER super global has the 'argv' key before returning false permits cli to continue to function while using php-cgi.
Inspired by your answer, this worked for me:
public static function cli()
{
if(array_key_exists('HTTP_HOST', $_SERVER)) return false;
return defined('STDIN') || (substr(PHP_SAPI, 0, 3) == 'cgi' && getenv('TERM'));
}

Alert with jqGrid error messages

I would like to get an alert when errors occur when loading my jqGrid table. For instance, when the jsonReader is not well configured, like when repeatitems is true instead of false, U can see in Firebug the error:
ccur is undefined
[Break On This Error] idr = ccur[idn] || idr;
How can I place such an error in an alert? I have already tried using loadError, but it doesn't work, because it is not even triggered.
It seems for me that you should just use try - catch block over jqGrid code:
try {
// create the grid
$("#list").jqGrid({
// all jqGrid options
});
} catch (err) {
// display the error message which you want
alert(err);
}
UPDATED: You are right, the try {...} catch (err) {...} which I described before work in IE only with reading local data. In case of getting data from the server the exception take place inside of success callback of $.ajax. To be exactly it take place inside of addJSONData or addXmlData depend of the type of data which you use. To catch the exception you should modify code of jqGrid in the place. The modified code can be about the following
success:function(data,st, xhr) {
if ($.isFunction(ts.p.beforeProcessing)) {
ts.p.beforeProcessing.call(ts, data, st, xhr);
}
try {
if(dt === "xml") { addXmlData(data,ts.grid.bDiv,rcnt,npage>1,adjust); }
else { addJSONData(data,ts.grid.bDiv,rcnt,npage>1,adjust); }
if(lc) { lc.call(ts,data); }
if (pvis) { ts.grid.populateVisible(); }
} catch (err) {
alert(err);
}
if( ts.p.loadonce || ts.p.treeGrid) {ts.p.datatype = "local";}
data=null;
if (npage === 1) { endReq(); }
}
I tested in the demo the corresponding modified version of jquery.jqGrid.src.js which display error message. I don't reproduced exactly the error which you described so the error message is a little other as in your case.
If you need minimized version of the modified jquery.jqGrid.src.js file you can produce it yourself with any JavaScript minimizer. For example Microsoft Ajax Minifier can be free downloaded and installed. The usage as
ajaxmin.exe jquery.jqGrid.src.js -out jquery.jqGrid.min.js
will produce the new minimized version of jquery.jqGrid.src.js which will be even a little smaller as the original jquery.jqGrid.min.js.
Another good minimizer is available online here. You should use "Simple" Optimization only.

CA2202 Warning from Code Analysis for OracleConnection disposal

We are getting the following warning from Code Analysis in Visual Studio 2010 and I'm wondering if this is a false positive that we can safely ignore or the code should be refactored to correctly dispose the object.
The relevant code:
public void MyFunction()
{
OracleConnection oraConnection = null;
OracleCommand oraCommand = null;
try
{
// Connect to the database
oraConnection = new OracleConnection(connectionString);
oraConnection.Open();
// Prepare and run the query
oraCommand = new OracleCommand(sqlQuery, oraConnection);
oraCommand.ExecuteNonQuery();
}
catch { throw; }
finally
{
// Perform a safe cleanup
if (oraCommand != null) { oraCommand.Dispose(); }
if (oraConnection != null)
{
oraConnection.Close();
oraConnection.Dispose();
}
}
}
The relevant error message:
Warning 18 CA2202 : Microsoft.Usage : Object 'oraConnection' can be disposed
more than once in method 'ClassName.MyFunction()'. To avoid generating a
System.ObjectDisposedException you should not call Dispose more than one
time on an object.
If you remove the line:
oraConnection.Close();
it should get rid of the warning, since closing and disposing a connection are essentially the same thing.
You might also want to replace your try/finally by a using statement.
Note that Microsoft's own guidelines say that IDisposable.Dispose should be implemented in such a way that it can safely be called multiple times. Which means that the CA2202 warning can safely be ignored, as noted in the comment by JoeM27 on the MSDN page for CA2202.

Resources