[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
@@ -2502,12 +2502,12 @@ function shop_is_taxsave($od, $is_view_receipt=false){
|
||||
}
|
||||
|
||||
if( $od_pay_type ) {
|
||||
if( $default['de_taxsave_use'] && strstr( $default['de_taxsave_types'], $od_pay_type ) ){
|
||||
if( $default['de_taxsave_use'] && strpos( $default['de_taxsave_types'], $od_pay_type ) !== false ){
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// 아직 현금영수증 받기전 상태일때만
|
||||
if( $is_view_receipt && ! $od['od_cash'] && in_array($od['od_settle_case'], array('계좌이체', '가상계좌')) && ! strstr( $default['de_taxsave_types'], $od_pay_type ) ){
|
||||
if( $is_view_receipt && ! $od['od_cash'] && in_array($od['od_settle_case'], array('계좌이체', '가상계좌')) && strpos( $default['de_taxsave_types'], $od_pay_type ) === false ){
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user