PHP 8.5.0 Alpha 4 available for testing

Voting

: three plus six?
(Example: nine)

The Note You're Voting On

YLearn
19 years ago
Regarding topcat's suggested change, I am split on doing that. I don't like showing users errors that may give them more information than they should have (or show that I haven't provided for that particular error). But I want to know when there are errors that fall to the default case so I can fix my code. What I will typically do is write them to the error log something like this modification to metaltoad's post (takes into account the possibility of multi-line errors which error_log doesn't handle well):

<?php
default: //a default error, just in case! :)
echo "There was a problem with your upload.";
$err_msg = "Unrecognized file POST error: ".$HTTP_POST_FILES['userfile']['error'];
if ((
strpos($err_msg, "\n") === 0) {
$err_lines = explode("\n", $err_msg);
foreach (
$err_lines as $msg) {
error_log($msg, 0);
}
} else {
error_log($err_msg, 0)
}
break;
?>

<< Back to user notes page

To Top