01. Warning: Creating default object from empty value
    - modules/member/member.model.php line 979
    - modules/member/member.model.php line 363
    - modules/member/member.model.php line 343
    - modules/member/member.controller.php line 1860
    - classes/context/Context.class.php line 381
    - index.php line 47

 

이런 오류가 나타나서

 

$info->width = $width;

이 부분을

 

if (!isset($info)) 
$info = new stdClass();
$info->width = $width;

이런 식으로 수정해서 해결했는데요

 

여기서 궁금한게...

 

1. 저렇게 수정하는게 맞는건가요? http://stackoverflow.com/questions/8900701/creating-default-object-from-empty-value-in-php 이걸 참고했는데, 다른 서드파티 자료들에도 저런 부분들이 존재해서 그것들도 똑같이 조치했더니 오류가 사라졌습니다.

 

2. 이걸 제 서버의 git branch에 commit할 경우, 나중에 오리지날 라이믹스 develop 브랜치에 저 부분이 수정된 커밋이 올라가면 어떻게 적용시키나요? 똑같이 line 979 부분이 수정되었기 때문에 confilct가 발생할 거 같은데...

  • profile

    new stdClass 선언하는 줄만 있으면 됩니다. 윗줄의 조건문은 필요없습니다.

    오늘 안에 패치해 드릴 테니 커밋하지 말고 기다리세요^^

  • profile ?
    감사합니다. 궁금한게, 저기 두번째 답변에서

    "You should always check if the object already exists, unless you are absolutely sure that it doesn't. The code provided by Michael is no good in general, because in some contexts the object might sometimes be already defined at the same place in code, depending on circumstances."

    라고 써 있어서 저 사람이 말한 조건문까지 달았는데, 애초에 저 구문 자체가 없어도 별 상관 없는건가요? 그럼 다른 (같은 오류메세지를 출력하는) 자료들도 똑같이 if구문 없어도 되나요?
  • ? profile

    문제의 함수에서는 앞뒤 문맥상 $info 변수가 존재할 수가 없습니다.
    다른 함수에서는 다를 수도 있지요.

    대부분의 경우에는 조건문이 필요하지 않습니다.

    Creating default object 오류는 라이믹스에서 거의 다 패치했다고 생각했는데
    왜 거기만 빠졌는지 모르겠네요. 바로 위에도 비슷한 코드가 2군데나 있는데 말이죠 ㅎㅎ