PHP 5.4: disable warning “Creating default object from empty value”

前端 未结 4 1926
萌比男神i
萌比男神i 2020-12-10 05:16

I want to migrate code from PHP 5.2 to 5.4. This worked fine so far except that all the code I use makes extensive use of just using an object with a member without any init

4条回答
  •  庸人自扰
    2020-12-10 05:49

    you really could use an IDE for php and try to do this:

    Search for $MyObject->MyMember = "Hello";

    Look for the results and if it brings the right things, try to replace that with:

    $MyObject = new stdClass();
    $MyObject->MyMember = "Hello";
    

    So maybe the IDE would do the long work for you...

提交回复
热议问题