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

Clean up the use of @ operator #99

Open
5 of 9 tasks
chesio opened this issue May 24, 2017 · 2 comments
Open
5 of 9 tasks

Clean up the use of @ operator #99

chesio opened this issue May 24, 2017 · 2 comments

Comments

@chesio
Copy link
Contributor

chesio commented May 24, 2017

Inspired by discussion in #98. Here's a list of current uses of @ operator in the plugin:

Let's try to reduce this list to necessary minimum :-)

@angcl
Copy link
Contributor

angcl commented Feb 13, 2022

Perhaps this issue could be closed now because #256 was merged.

@stklcode
Copy link
Contributor

stklcode commented Feb 13, 2022

The master references in the first comment pointed to inexisting files. I've just updated them by comparing the code from 05/2017 to the current develop state with fixed commit references.

4 usages are left. One of them has custom error handling. Is there any scenario in which a warning from the other calls is really superfluous?

@apc_clear_cache( 'user' );

This is plain suppression without any custom handling. If the call fails, flusing did not work and the user probably won't notice.

$handle = @fopen( $file, 'wb' );
if ( ! $handle ) {

Error handling is done in the next line using trigger_error.

$stat = @stat( dirname( $file ) );
$perms = $stat['mode'] & 0007777;

If the stat() call fails here and the result is false, a warning is generated in the very next line with a warning like "Trying to access array offset on value of type bool".
I would prefer the original warning "stat failed for [filename]" here.

if ( self::_user_can_delete( $dir ) && 0 === count( glob( trailingslashit( $dir ) . '*' ) ) ) {
@rmdir( $dir );
}

If this fails, we leave some directories on the filesystem. It should not occur, if _user_can_delete is implemented correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants