fix: adds check for original content existence#18
fix: adds check for original content existence#18gwleuverink merged 3 commits intoNativePHP:mainfrom
Conversation
|
This is great I was just looking into a bug report about this 👌 I have to double check but I think we can do away with the early return. If originalContent was null in the first place it's probably okay continue execution |
The problem, was that it wasn't null but missing altogether. We could do away with the early return but will need to guard against dynamic property creation at the end by doing something like: if (property_exists($handled->response, 'original')) {
$handled->response->original = $originalContent;
}Keen to hear thoughts |
|
Perfect yeah that feels right. I'm not sure why that original property is usually present but sometimes not. And I'm weary that an early return might cause some hard to debug issues down the line. So your latest suggestion is great 👌 Would you be willing to add that? I'll test it and make sure it's released tomorrow |
@gwleuverink - No problem, all done 👍 |
|
Hey @jsandfordhughescoop I've just pulled in your PR. Running into a static analysis issue. https://github.com/NativePHP/desktop/actions/runs/18675299098/job/53248255203?pr=18 It says that
Do you have any idea why it could be missing? Do you have the original error message or how to reproduce? |
|
Hmm I reproduced it. In my case it is thrown on a Weird eh? I suppose Laravel must be dispatching this event even other response types so their phpdoc type in the event is a bit misleading. I'll just ignore the line in phpstan, your solution works as it should 👍🏻 |
|
|
Merged! Thanks @jsandfordhughescoop 🙏🏻 I'll be looking into some other issues & do a combined release later today |
I was unable to build or run the application because the
$handled->responseobject did not contain theoriginalproperty.I implemented a local fix that resolved the issue at the time. However, after several subsequent builds and runs, I haven’t been able to reproduce the problem — all
$handled->responseobjects now correctly include theoriginalproperty.I’m not sure what initially caused the missing property, but this change ensures that similar build or runtime failures won’t occur in the future.