<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>

CC BY-SA 3.0
2017-11-06T18:25:06.570Z
Are you running the latest Commerce version? https://craftcommerce.com/changelog
Brad Bell
CC BY-SA 3.0
2017-11-06T18:27:18.953Z
Yes installed latest earlier today
mmc501
CC BY-SA 3.0
2017-11-06T18:33:19.417Z
Weird... if you `die($billingAddress->getState());` right before line 234 there, does it output anything?
Brad Bell
CC BY-SA 3.0
2017-11-06T19:21:04.707Z
Weird alright! - no just a blank screen is i put that in.
mmc501
CC BY-SA 3.0
2017-11-06T19:44:33.230Z
I can't see how it should even pass the `if ($billingAddress->getState())` conditional if it is returning empty/null.
Brad Bell
CC BY-SA 3.0
2017-11-06T20:59:16.700Z
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.
mmc501
CC BY-SA 3.0
2017-11-07T01:48:36.960Z
Can you try deleting the order/cart in the control panel and try again?
Luke Holder
CC BY-SA 3.0
2017-11-07T03:20:04.130Z
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.
Brad Bell
CC BY-SA 3.0
2017-11-07T06:11:22.423Z
Had tried the deleting orders but no success either. 
wincache was enabled but I disabled but it has made no difference.
mmc501
CC BY-SA 3.0
2017-11-07T06:35:06.287Z
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`.
mmc501
<plugin-craftcommerce><error-message><error>
Commerce - Live Environment - "Trying to get property of non-object"
# 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

