Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yii prevent third-party register_shutdown_function #6637

Closed
m8rge opened this issue Dec 24, 2014 · 3 comments
Closed

Yii prevent third-party register_shutdown_function #6637

m8rge opened this issue Dec 24, 2014 · 3 comments
Labels
status:to be verified Needs to be reproduced and validated. status:under discussion

Comments

@m8rge
Copy link

m8rge commented Dec 24, 2014

According to http://php.net/manual/en/function.register-shutdown-function.php,

If you call exit() within one registered shutdown function, processing will stop completely and no other registered shutdown functions will be called.

In Yii sources:

Why this exit(1) is necessary here? It prevents other shutdown function calls!

@samdark
Copy link
Member

samdark commented Dec 24, 2014

exit(1) is necessary to send response code 1 to console if application is run in command line.

@m8rge
Copy link
Author

m8rge commented Dec 24, 2014

php itself will return 255 on fatal error:

<?php

function handleFatalError() {
    echo __FUNCTION__."\n";
}

register_shutdown_function('handleFatalError');

callToUndefinedFunction();
$ php ./shutdown.php 

Fatal error: Call to undefined function callToUndefinedFunction() in /Volumes/work/warehouse/shutdown.php on line 17

Call Stack:
    0.0002     226712   1. {main}() /Volumes/work/warehouse/shutdown.php:0

handleFatalError
$ echo $?
255

Isn't it work for us?

@samdark samdark added status:to be verified Needs to be reproduced and validated. status:under discussion labels Dec 24, 2014
@samdark samdark added this to the 2.0.2 milestone Dec 24, 2014
@qiangxue qiangxue modified the milestones: 2.0.x, 2.0.2 Jan 4, 2015
@dynasource
Copy link
Member

exit(1) is important for tools like gulp & grunt. If you have any alternative fixes in mind, feel free to do a suggestion

@cebe cebe removed this from the 2.0.x milestone Nov 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:to be verified Needs to be reproduced and validated. status:under discussion
Projects
None yet
Development

No branches or pull requests

5 participants