【バグ・改善】 document.parser.class.inc.php  【解決済み】

質問全般・改善要望
返信する
Ralph
メンバー
メンバー
記事: 24
登録日時: 2012年8月09日(木) 11:42

【バグ・改善】 document.parser.class.inc.php  【解決済み】

投稿記事 by Ralph »

最新バージョン(1.0.6-r5)でもそうだったんですが、「runSnippet」のコードに一部不足が見られました。

コード: 全て選択

	function runSnippet($snippetName, $params= array ())
	{
		if (isset ($this->snippetCache[$snippetName]))
		・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
			if ($this->db->getRecordCount($result) == 1)
			{
ココ→		$snippet= $this->snippetCache[$snippetName]= $row['snippet'];
ココ→		$properties= $this->snippetCache["{$snippetName}Props"]= $row['properties'];
			}
		・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
	}
「$result」がフェッチされていないので、$rowがNULLとなり、外部PHPからのスニペットの呼び出しができませんでした。

1.0.6-r4にて以下の一行を挿入したら正常に動作しました。

コード: 全て選択

	function runSnippet($snippetName, $params= array ())
	{
		if (isset ($this->snippetCache[$snippetName]))
		・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
			if ($this->db->getRecordCount($result) == 1)
			{
ココ→			$row = $this->db->getRow($result);
				$snippet= $this->snippetCache[$snippetName]= $row['snippet'];
				$properties= $this->snippetCache["{$snippetName}Props"]= $row['properties'];
			}
		・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
	}
以上、よろしくお願いいたします。
最後に編集したユーザー Ralph [ 2012年8月10日(金) 11:00 ], 累計 1 回
アバター
yama
管理人
記事: 3236
登録日時: 2009年7月29日(水) 02:50

Re: 【バグ?】 document.parser.class.inc.php

投稿記事 by yama »

なるほど、そのとおりですね。たまたまsnippetCacheに値が入っていて気付かないケースもありそうですが、バグなので修正します。
返信する