[perf]strstr() 불린 검사를 strpos() !== false 로 교체
strstr()은 일치하는 부분 문자열 전체를 반환하므로 존재 여부만 체크할 때는 메모리 할당이 낭비됨. strpos()는 위치(int) 또는 false만 반환하여 메모리 할당 없이 더 빠르게 동일 동작 수행. 적용 파일 (19개, 약 25곳): - lib/common.lib.php: wr_option html1/html2/secret 검사 3곳 - lib/shop.lib.php: de_taxsave_types 검사 2곳 - lib/latest.lib.php: wr_option secret 검사 1곳 - lib/thumbnail.lib.php: wr_option secret 검사 1곳 - lib/URI/uri.class.php: URI 확장자 검사 1곳 - bbs/view.php: subject/wr_option/content 검사 4곳 - bbs/view_comment.php: wr_option secret 검사 1곳 - bbs/search.php: wr_option/sfl 검사 3곳 - bbs/rss.php: wr_option html 검사 1곳 - bbs/write_update.php: html1/html2 검사 2곳 - bbs/move_update.php: wr_option html 검사 1곳 - adm/admin.lib.php: auth 권한 검사 1곳 - adm/admin.head.php: 메뉴 권한 검사 1곳 - adm/session_file_delete.php: sess_ prefix 검사 1곳 - adm/point_list.php, adm/auth_list.php: sfl mb_id 검사 2곳 - adm/sms_admin/_common.php: install.php 검사 1곳 - adm/shop_admin/configform.php: de_taxsave_types 검사 3곳 - head.sub.php: admin dir 검사 1곳 규칙: strstr($a, $b) → strpos($a, $b) !== false !strstr($a, $b) → strpos($a, $b) === false 제외: - theme/, skin/, plugin/ (사용자 커스터마이징/서드파티) - strstr() 반환값을 실제로 사용하는 케이스 (예: lib/common.lib.php:4135 if( \$freg = strstr(\$ori_params, '#') ), extend/gif2mp4.extend.php)
This commit is contained in:
1 parent
a612e69d3e
commit
31ef78e916
19 files changed
+31
-31
No files matched your search
+3
-3
@@ -462,9 +462,9 @@ function get_list($write_row, $board, $skin_url, $subject_len=40)
|
||||
if ($board['bo_use_list_content'])
|
||||
{
|
||||
$html = 0;
|
||||
if (strstr($list['wr_option'], 'html1'))
|
||||
if (strpos($list['wr_option'], 'html1') !== false)
|
||||
$html = 1;
|
||||
else if (strstr($list['wr_option'], 'html2'))
|
||||
else if (strpos($list['wr_option'], 'html2') !== false)
|
||||
$html = 2;
|
||||
|
||||
$list['content'] = conv_content($list['wr_content'], $html);
|
||||
@@ -525,7 +525,7 @@ function get_list($write_row, $board, $skin_url, $subject_len=40)
|
||||
$list['icon_hot'] = '<i class="fa fa-heart" aria-hidden="true"></i> ';
|
||||
|
||||
$list['icon_secret'] = '';
|
||||
if (strstr($list['wr_option'], 'secret'))
|
||||
if (strpos($list['wr_option'], 'secret') !== false)
|
||||
$list['icon_secret'] = '<i class="fa fa-lock" aria-hidden="true"></i> ';
|
||||
|
||||
// 링크
|
||||
|
||||
Reference in new issue
Block a user