You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
-
2For the most part, I agree, however 'Your Common Sense' i disagree with, "Not just write code to circumvent an error" what do you think a try...catch does, it circumvents the error to prevent the codebase exiting out in an uncontrolled manner, some errors you can't fix in code E.G DB server has gone away, you just have to manage the error and circumvent the error to poduce a valid result.Barkermn01– Barkermn012020-09-09 14:44:16 +00:00Commented Sep 9, 2020 at 14:44
-
4@Barkermn01 that's a proper concern of yours but you are drawing wrong conclusions from it. Of course your application should produce a valid result (which, in case of a "Mysql has gone away" error should be a generic 500 error page). But you have to understand that such a valid result is not a concern of your database code. Your database related code should work with a database. Whereas showing the error page should be a concern of a different code. See here: phpdelusions.net/articles/error_reportingYour Common Sense– Your Common Sense2020-09-09 14:50:59 +00:00Commented Sep 9, 2020 at 14:50
-
1"Uncaught exception, in turn, makes a PHP fatal error" Is causing a fatal error a good idea on a PRODUCTION server (for mysql errors)? Aren't there a few situations where the error indicates a problem that your script should deal with, and continue however it can; e.g. inform the user that you can't give them that info right now, while alerting an operator to investigate? EDIT I see, where needed you try..catch mysql errors (that you have converted to php errors).ToolmakerSteve– ToolmakerSteve2021-07-10 12:32:01 +00:00Commented Jul 10, 2021 at 12:32
-
1@ToolmakerSteve surely you meant the error handler, not a try catchYour Common Sense– Your Common Sense2022-07-22 13:46:34 +00:00Commented Jul 22, 2022 at 13:46
-
1As of PHP 8.1.0, the default setting is MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT. Previously, it was MYSQLI_REPORT_OFF. php.net/manual/en/mysqli-driver.report-mode.phpInvisionary– Invisionary2022-11-18 17:29:03 +00:00Commented Nov 18, 2022 at 17:29
|
Show 3 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. python-3.x), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you
lang-php