Symfony display exceptions in prod environment - symfony

In prod env when error occurured symfony displays a standard error page.
This is the standard default framework error page:
But when PDO can't connect to database symfony display this error to the client:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known' in /homepages/35/d619429344/htdocs/mcg/web/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43 Stack trace: #0 /homepages/35/d619429344/htdocs/mcg/web/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('mysql:host=db63...', 'dbo632759072', 'mgm_mgm', Array) #1 ...
PDO exeptions:
I can't display this error to the client for security reason.
Any ideas on how to disable these messages and redirect to an error page like other error ?

You should have display_errors = off in your PHP.ini anyway to avoid this problem. Errors that reveal details like these come from many places, in addition to PDO.

Related

Symfony Compile Error Failed opening required Proxies

I download a new sylius 1.5 project and i deploy it on a sharedhost server. In local all work very well both in dev and prod environnement. But online prod env don't work. Here is the exception in prod log
Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalErrorException:
Compile Error: require(): Failed opening required 'var/cache/prod/doctrine/orm/Proxies/__CG__some-file.php' (include_path='.:/usr/share/php7:/usr/share/php') at vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php line 223
I don't know how to resolve this problem. thanks
When i laod page for the first time the page it work. But when i click on link or refresh the page i have a blank page with message
this page is currently unable to handle this request
In cPanel Configure PHP INI basic settings section i enable display_errors and when i refresh the page this error is displayed
Fatal error: require_once(): Failed opening required 'phar:///home/ki327452/public_html/acme/vendor/phpstan/phpstan-shim/phpstan.phar/vendor/autoload.php' (include_path='.:/opt/cpanel/ea-php72/root/usr/share/pear') in /home/ki327452/public_html/acme/vendor/phpstan/phpstan-shim/bootstrap.php on line 8
I wait a few moment and when i refresh again it works.And that is a boucle in which i am.

Error loading repositories

In the Azure portal, when I go to my Container Registry and click on Repositories (under Services), my repositories don't load and I get the error message Error loading repositories.
The console of Chrome contains the following error messages:
GET https://REMOVED.azurecr.io/v2/_catalog 401 (Unauthorized) - REMOVED.azurecr.io/v2/_catalog:1
[Microsoft_Azure_ContainerRegistries] 1:20:06 PM -
efe5474C39B089216811DEA68B8392644A0C676A067.js:24 (With body:)
MsPortalFx.Base.Diagnostics.ErrorReporter 1 MsPortalFx.Base.Diagnostics.ErrorReporter: _errorData: undefined
_sourceErrorLevel: undefined
baseTypes: ["MsPortalFx.Errors.AjaxError","MsPortalFx.Errors.Error"]
code: undefined
data: {"type":"GET","sessionId":"9e259d2b5dab4ad2972a1e6b76e844d2","status":401,"statusText":"Unauthorized","duration":28.5}
errorLevel: 2
errorThrown: Unauthorized
extension: Microsoft_Azure_ContainerRegistries
handled: undefined
innerErrors: []
jqXHR: {"readyState":4,"responseText":"{\"errors\":[{\"code\":\"UNAUTHORIZED\",\"message\":\"authentication required\",\"detail\":[{\"Type\":\"registry\",\"Name\":\"catalog\",\"Action\":\"*\"}]}]}\n","responseJSON":{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"registry","Name":"catalog","Action":"*"}]}]},"status":401,"statusText":"Unauthorized"}
message: ajaxExtended call failed
name: Error
source: undefined
stack: null
textStatus: error
timestamp: 1567.8750000000002
type: MsPortalFx.Errors.AjaxError
The error says I'm unauthorized, but I have the Owner role, so this should not be possible. Other users that are owner don't get this error.
Any clue how I can fix this?
The error resolved itself after a couple of days.
I tried using a different browser and a different computer. Both methods still showed the error. So I think it might have been a bug.
just uploaded my AKS and needed to pull lots of images from ACR. also got error afterwards due to load:
{"type":"MsPortalFx.Errors.FetchDataError","baseTypes":["MsPortalFx.Errors.FetchDataError","MsPortalFx.Errors.DataError","MsPortalFx.Errors.Error"],"_errorData":{"readyState":4,"responseText":"","status":500,"statusText":"Internal Server Error"},"extension":"Microsoft_Azure_ContainerRegistries","errorLevel":2,"timestamp":10180.93499999668,"source":"DataCache:2:3","message":"","name":"Error","innerErrors":[],"dataSetName":"DataCache:2:3"}

ReflectionException in Symfony application

i deployed my symfony application on my server and it works fine in dev mode but in prod mode i have this error :
Fatal error: Uncaught exception 'ReflectionException' with message
'Class
Sharincook\MessagerieBundle\Entity\Sharincook\MessagerieBundle\Entity\Message
does not exist
and if i try to clean cache with putty i have this error :
syntax error, unexpected T_STRING, expecting
T_CONSTANT_ENCAPSED_STRING or '(' in ....app/console
so i don't have any ideas
thanks

Symfony2 Track Database access call on composer install

I would need advices to figure out how to see which bundle/class/portion of code tries to access the database on Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
Indeed during the composer install process. I get the following error message.
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
[Doctrine\DBAL\Exception\ConnectionException]
An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused
I am wondering why the database needs to be called at this stage and by whom ?
in advance thanks.

symfony 2.8 debug fatal error double message

Environment: Symfony 2.8.1 with XAMPP Version 5.5.24 on Windows 7.
If I trigger a fatal error in a controller, anything as simple as $array = ; in production environment, I'm getting a default php error:
Parse error: syntax error, unexpected ';' in C:\xampp\htdocs\tgsupport-test\src\AppBundle\Controller\DefaultController.php on line 16
followed by symfony custom error page message. Obviously I'd want to avoid to show eorr info in production.
Moreover in prod.log I see a double critical error: under php.CRITICAL and request.CRITICAL. Is really useful to show the same error twice?
I'm using default configuration, indeed I just installed default framework without any custom setting and I triggered my error in AppBundle/DefaultController, so I was wondering if I'm missing anything.
I missed a php.ini configuration to avoid to display error messages in page.

Resources