From e801513ea0fa466743c0548e865b4c2c5bea0c4e Mon Sep 17 00:00:00 2001
From: renato <renato@rezo.net>
Date: Tue, 2 Jan 2007 19:01:49 +0000
Subject: [PATCH] PHP throws an error because spip_num_rows is not defined if
 spip_query has not been called yet.

---
 ecrire/inc/meta.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ecrire/inc/meta.php b/ecrire/inc/meta.php
index 61013e1991..d04a6dba0c 100644
--- a/ecrire/inc/meta.php
+++ b/ecrire/inc/meta.php
@@ -33,7 +33,8 @@ function ecrire_meta($nom, $valeur, $importable = NULL) {
 		if (!_FILE_CONNECT && !@file_exists(_FILE_CONNECT_INS .'.php')) return;
 		// conserver la valeur de impt si existante
 		if ($importable === NULL){
-			if (@spip_num_rows(spip_query("SELECT * FROM spip_meta WHERE nom="._q($nom))))
+			$res = spip_query("SELECT * FROM spip_meta WHERE nom="._q($nom));
+			if (@spip_num_rows($res))
 				spip_query("UPDATE spip_meta SET valeur=" . _q($valeur) . " WHERE nom="._q($nom));
 			else
 				spip_query("INSERT spip_meta (nom, valeur) VALUES ("._q($nom).", " . _q($valeur) . ")");
-- 
GitLab