이 페이지에서

평가

이 경고 카테고리의 철자는 [eval] 입니다.

eval을 사용하지 마세요.

무슨 일이 있었나요?

코드에 eval 을 사용했습니다.

이것이 왜 나쁜가요?

eval 메서드는 느리고 잠재적으로 위험합니다. eval 인수를 마치 자체 JavaScript 스크립트인 것처럼 실행하므로 실행에 약간의 오버헤드가 추가됩니다. eval 에 전달된 인수는 잠재적으로 원격 코드 실행 공격의 벡터가 될 수 있습니다.

예시

import QtQuick

Item {
    function f() {
        let myString = "x",
        myObject = {
            x: 10
        },
        value = eval("myObject." + myString);
    }
}

이 경고를 수정하려면 eval 호출이 포함되지 않도록 코드를 다시 작성하세요.

import QtQuick

Item {
    function f() {
        let myString = "x",
        myObject = {
            x: 10
        },
        value = myObject[myString];
    }
}

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.