File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -263,7 +263,7 @@ public function makeDistInfo($bkupDistInfoArray)
263263 /**
264264 * distinfo.php を安全にパースして $distinfo 配列を返す.
265265 *
266- * include を使わず、ファイル内容をトークン解析することで
266+ * include を使わず、ファイル内容を正規表現でパースすることで
267267 * 任意コード実行を防止する.
268268 *
269269 * @param string $path distinfo.php のパス
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class SC_Batch_Update_parseDistInfoTest extends PHPUnit_Framework_TestCase
1313
1414 protected function setUp (): void
1515 {
16- if (!defined ('MODULE_REALDIR ' ) || !defined ('HTML_REALDIR ' )) {
16+ if (!defined ('MODULE_REALDIR ' ) || !defined ('HTML_REALDIR ' ) || ! defined ( ' DATA_REALDIR ' ) ) {
1717 $ this ->markTestSkipped ('EC-CUBE constants are not defined. ' );
1818 }
1919 $ this ->batch = new SC_Batch_Update ();
@@ -27,9 +27,11 @@ protected function setUp(): void
2727
2828 protected function tearDown (): void
2929 {
30- // テンポラリファイルを削除
31- array_map ('unlink ' , glob ($ this ->tmpDir .'/* ' ));
32- rmdir ($ this ->tmpDir );
30+ // テンポラリファイルを削除 (setUp がスキップした場合は tmpDir が null のため guard が必要)
31+ if ($ this ->tmpDir !== null && is_dir ($ this ->tmpDir )) {
32+ array_map ('unlink ' , glob ($ this ->tmpDir .'/* ' ) ?: []);
33+ rmdir ($ this ->tmpDir );
34+ }
3335 if (file_exists ('/tmp/pwned.txt ' )) {
3436 unlink ('/tmp/pwned.txt ' );
3537 }
You can’t perform that action at this time.
0 commit comments