eldan88 Posted April 16, 2014 Share Posted April 16, 2014 Hey guys. I am trying to assign a property in my class to a true value. What I realized is that when I assign true to the property it doesn't display an error even when calling an object that does not exisit for example this would be the correct calling of an object $validator->delivery_method_session = true; this is the incorrect calling of an object $validatorrrrr ->delivery_method_session = truel When assiging it true to an incorrect calling of an object it doesnt display any error message?? Does any might know why that happens?? Thanks! Link to comment https://forums.phpfreaks.com/topic/287828-assigning-boolean-values-to-non-objects-display-no-errors/ Share on other sites More sharing options...
Psycho Posted April 16, 2014 Share Posted April 16, 2014 Huh? I am not following what you are saying. That is not the "calling" of an object, that is the setting of a property for an object. Plus, you would normally use setter and getter methods for properties. You can create new Objects and Properties on-the-fly - just like when you create a variable using something like: $foo = 'bar'; You don't have to declare the object and property as you do in some languages. So, by using the wrong object name it is just creating a new object and setting that value to the property name. Turn on error reporting in strict mode and you'll see a warning. Likewise if you were using a setter method you would see an error as well. error_reporting(E_STRICT); When using the above error reporting mode, this is the type of error you would receive Strict Standards: Creating default object from empty value in C:\xampp\htdocs\test\test.php on line 18 Link to comment https://forums.phpfreaks.com/topic/287828-assigning-boolean-values-to-non-objects-display-no-errors/#findComment-1476430 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.