Body: <p>I have a site and been tested locally and on staging server and it checks out fine.
  I have moved it to the clients live server (Windows 2016) but when I hit the pay button via dummy gateway or Worldpay Gateway I get the error: </p>
  
  <p>Trying to get property of non-object:</p>
  
  <p><a href="https://i.sstatic.net/IS8rb.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/IS8rb.png" alt="enter image description here"></a></p>
  
  <p>Why is this only occuring on the Live Environment - PHP version is the same locally as the server - 7.1.7</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-06T18:25:06.570Z
Comments.Text: Are you running the latest Commerce version? https://craftcommerce.com/changelog
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-06T18:27:18.953Z
Comments.Text: Yes installed latest earlier today
Comments.UserDisplayName: mmc501
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-06T18:33:19.417Z
Comments.Text: Weird... if you `die($billingAddress->getState());` right before line 234 there, does it output anything?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-06T19:21:04.707Z
Comments.Text: Weird alright! - no just a blank screen is i put that in.
Comments.UserDisplayName: mmc501
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-06T19:44:33.230Z
Comments.Text: I can't see how it should even pass the `if ($billingAddress->getState())` conditional if it is returning empty/null.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-06T20:59:16.700Z
Comments.Text: Yep I see what you are saying - strange. I put in `echo($billingAddress->getState());` before the `if ($billingAddress->getState())` conditional and it gets to the next stage fine.  But if i remove it I get the error again.
  What could the cause be - works fine on local and staging - just the live server i get that error.
Comments.UserDisplayName: mmc501
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-07T01:48:36.960Z
Comments.Text: Can you try deleting the order/cart in the control panel and try again?
Comments.UserDisplayName: Luke Holder
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-07T03:20:04.130Z
Comments.Text: Does the production box have APC/opcache (or any other PHP byte level caching extension) installed?  Only thing I can think of is it's either that or a Windows/PHP bug.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-07T06:11:22.423Z
Comments.Text: Had tried the deleting orders but no success either. 
  wincache was enabled but I disabled but it has made no difference.
Comments.UserDisplayName: mmc501
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-07T06:35:06.287Z
Comments.Text: Ok - so played with it a little more - before the `if ($billingAddress->getState())` conditional I have put in 2 lines: `echo($billingAddress->getState());` and `die($billingAddress->getState());` I have tried cecking out 3 times and those times I have checked out it has displayed a state on the screen - first, `Minnesota`then `Mississippi` and then `Missouri`.
Comments.UserDisplayName: mmc501
Tags: <plugin-craftcommerce><error-message><error>
Title: Commerce - Live Environment - "Trying to get property of non-object"
ThreadText: # Commerce - Live Environment - "Trying to get property of non-object"
  
  (Asked by: username_0 on 2017-11-06)
  
  I have a site and been tested locally and on staging server and it checks out fine.
  I have moved it to the clients live server (Windows 2016) but when I hit the pay button via dummy gateway or Worldpay Gateway I get the error:
  
  Trying to get property of non-object:
  
  [![enter image description here](https://i.sstatic.net/IS8rb.png)](https://i.sstatic.net/IS8rb.png)
  
  Why is this only occuring on the Live Environment - PHP version is the same locally as the server - 7.1.7
  
  **Tags:** plugin-craftcommerce, error-message, error
  
  > **Comments:**
  > **username_1**: Are you running the latest Commerce version? https://craftcommerce.com/changelog  
  > **username_0**: Yes installed latest earlier today  
  > **username_1**: Weird... if you `die($billingAddress->getState());` right before line 234 there, does it output anything?  
  > **username_0**: Weird alright! - no just a blank screen is i put that in.  
  > **username_1**: I can't see how it should even pass the `if ($billingAddress->getState())` conditional if it is returning empty/null.  
  > **username_0**: Yep I see what you are saying - strange. I put in `echo($billingAddress->getState());` before the `if ($billingAddress->getState())` conditional and it gets to the next stage fine.  But if i remove it I get the error again. What could the cause be - works fine on local and staging - just the live server i get that error.  
  > **username_2**: Can you try deleting the order/cart in the control panel and try again?  
  > **username_1**: Does the production box have APC/opcache (or any other PHP byte level caching extension) installed?  Only thing I can think of is it's either that or a Windows/PHP bug.  
  > **username_0**: Had tried the deleting orders but no success either.  wincache was enabled but I disabled but it has made no difference.  
  > **username_0**: Ok - so played with it a little more - before the `if ($billingAddress->getState())` conditional I have put in 2 lines: `echo($billingAddress->getState());` and `die($billingAddress->getState());` I have tried cecking out 3 times and those times I have checked out it has displayed a state on the screen - first, `Minnesota`then `Mississippi` and then `Missouri`.  
  
  ---
  
  ## 0 answers
  
  