Title: PHP 7.3 Warning in php_errorlog
Last modified: January 1, 2020

---

# PHP 7.3 Warning in php_errorlog

 *  [gevcen](https://wordpress.org/support/users/gevcen/)
 * (@gevcen)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/php-7-3-warning-in-php_errorlog/)
 * `[01-Jan-2020 13:21:05 UTC] PHP Warning: fread() expects parameter 1 to be resource,
   bool given in /home/customer/www/HIDDEN_DOMAIN/public_html/wp-includes/functions.
   php on line 5785`
    `[01-Jan-2020 13:21:05 UTC] PHP Warning: fclose() expects 
   parameter 1 to be resource, bool given in /home/customer/www/HIDDEN_DOMAIN/public_html/
   wp-includes/functions.php on line 5788`
 * referring to the lines
    `$file_data = fread( $fp, 8 * KB_IN_BYTES );` and `fclose(
   $fp );`
 * in the file functions.php whose extract is given below :
 *     ```
       /**
        * Retrieve metadata from a file.
        *
        * Searches for metadata in the first 8 KB of a file, such as a plugin or theme.
        * Each piece of metadata must be on its own line. Fields can not span multiple
        * lines, the value will get cut at the end of the first line.
        *
        * If the file data is not within that first 8 KB, then the author should correct
        * their plugin file and move the data headers to the top.
        *
        * @link https://codex.wordpress.org/File_Header
        *
        * @since 2.9.0
        *
        * @param string $file            Absolute path to the file.
        * @param array  $default_headers List of headers, in the format <code>array( 'HeaderKey' => 'Header Name' )</code>.
        * @param string $context         Optional. If specified adds filter hook {@see 'extra_$context_headers'}.
        *                                Default empty.
        * @return array Array of file headers in <code>HeaderKey => Header Value</code> format.
        */
       function get_file_data( $file, $default_headers, $context = '' ) {
       	// We don't need to write to the file, so just open for reading.
       	$fp = fopen( $file, 'r' );
   
       	// Pull only the first 8 KB of the file in.
       	$file_data = fread( $fp, 8 * KB_IN_BYTES );
   
       	// PHP will close file handle, but we are good citizens.
       	fclose( $fp );
   
       	// Make sure we catch CR-only line endings.
       	$file_data = str_replace( "\r", "\n", $file_data );
   
       	/**
       	 * Filters extra file headers by context.
       	 *
       	 * The dynamic portion of the hook name, <code>$context</code>, refers to
       	 * the context where extra headers might be loaded.
       	 *
       	 * @since 2.9.0
       	 *
       	 * @param array $extra_context_headers Empty array by default.
       	 */
       	$extra_headers = $context ? apply_filters( "extra_{$context}_headers", array() ) : array();
       	if ( $extra_headers ) {
       		$extra_headers = array_combine( $extra_headers, $extra_headers ); // keys equal values
       		$all_headers   = array_merge( $extra_headers, (array) $default_headers );
       	} else {
       		$all_headers = $default_headers;
       	}
   
       	foreach ( $all_headers as $field => $regex ) {
       		if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] ) {
       			$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
       		} else {
       			$all_headers[ $field ] = '';
       		}
       	}
   
       	return $all_headers;
       }
       ```
   
    -  This topic was modified 6 years, 4 months ago by [gevcen](https://wordpress.org/support/users/gevcen/).

Viewing 1 replies (of 1 total)

 *  [autotutorial](https://wordpress.org/support/users/autotutorial/)
 * (@autotutorial)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/php-7-3-warning-in-php_errorlog/#post-12284833)
 * means fopen returns false because the file does not exist or does not have read
   permissions.
    in my opinion it is not a bug but an incorrect configuration of
   the web server for theme or plugins.

Viewing 1 replies (of 1 total)

The topic ‘PHP 7.3 Warning in php_errorlog’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [autotutorial](https://wordpress.org/support/users/autotutorial/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/php-7-3-warning-in-php_errorlog/#post-12284833)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
