Joomla.it Forum

Joomla! 2.5 (versione con supporto terminato) => Joomla! 1.6/1.7/2.5 => : musicmania 13 Feb 2015, 08:19:25

: Errore php warning
: musicmania 13 Feb 2015, 08:19:25
Ciao a tutti ragazzi. Purtroppo non riesco a venirne a capo e questo errore php mi sta causando problemi di lentezza e a volte mi fa andare il sito in overload. Se apro il file error log la stringa di errore che appare sempre è questa:

PHP Warning:  mysqli_close() [<a href='function.mysqli-close'>function.mysqli-close[/url]]: Couldn't fetch mysqli in /home/balatoit/public_html/shop/libraries/joomla/database/database/mysqli.php on line 141

non riesco a capire cos'è ed in che modo posso risolvere.

Mi potete aiutare? Grazie a tutti
: Re:Errore php warning
: musicmania 13 Feb 2015, 08:27:40
Su JoomlaCode dice che questo errore si verifica su alcune versioni delle librerie di joomla, ed è riportato di sostituire il codice della riga 141, che è questo:

:
public function __destruct()
 {
 if (is_callable($this->connection, 'close'))
 {
 mysqli_close($this->connection);
 }
 }

con questo:

:
public function __destruct()
 {
 if (is_callable(array($this->connection, 'close')))
 {
 mysqli_close($this->connection);
 }
 }

Ho sostituito. Speriamo bene!!
Vi farò sapere.

Voi intanto cosa ne pensate?
: Re:Errore php warning
: musicmania 13 Feb 2015, 10:32:09
Ragazzi purtroppo niente gli errori continuano, sto impazzendo? Ma qualcuno ha mai avuto questo problema? In tutti i miei siti questo è il primo con questo problema!!
: Re:Errore php warning
: steganoga 13 Feb 2015, 11:53:52
..ma ce l'hai mysqli ( e l'hai usato) nel database?
..perchè la connessione dovrebbe essere un array.. o perchè usare un array per scorrere un oggetto?

poi... un warning è un warning e non un errore

poi ancora... se ci fosse da modificare qualcosa nel codice sarebbe stato oggetto di patch nelle successive versioni.
sconsiglio di seguire tutorial senza sapere cosa si sta facendo.
: Re:Errore php warning
: musicmania 13 Feb 2015, 12:03:44
Ciao Steganoga, innanzitutto grazie per la celere risposta.

Come mai si generano questi errori?
: Re:Errore php warning
: steganoga 13 Feb 2015, 15:12:37
The cryptic "Couldn't fetch mysqli" error message can mean any number of things, including:

1. You're trying to use a database object that you've already closed (as noted by ceo at l-i-e dot com). Reopen your database connection, or find the call to <?php mysqli_close($db); ?> or <?php $db->close(); ?> and remove it.
2. Your MySQLi object has been serialized and unserialized for some reason. Define a wakeup function to re-create your database connection. http://php.net/__wakeup
3. Something besides you closed your mysqli connection (in particular, see http://bugs.php.net/bug.php?id=33772)
4. You mixed OOP and functional calls to the database object. (So, you have <?php $db->query() ?> in the same program as <?php mysqli_query($db) ?>).

fonte: http://php.net/manual/en/mysqli.query.php