HTML Import 2
Fopen mode not specified (3 posts)

  1. mbrinson
    Posted 4 years ago #

    I'm surprised this hasn't come up anywhere else. Why does the code for reading in the contents not specify a mode for the fopen() function?

    I googled for a while and I couldn't find if there's a standard setting for php that makes it so that you don't have to specify the mode and when you just give the path then it defaults to read.

    In other words - I don't understand why no one else has problems with this line of code: $contents = fopen($path)

    According to the php documentation the mode parameter is required. So it should be $contents = fopen($path, "rb") or something like that. But then when specifying a mode, a reference to the resource is returned which is numeric. This causes problems later in the code when a string value is expected.

    Do you know what I'm talking about Stephanie?

    Any insights are very appreciated.


  2. Mark Tuttle
    Posted 4 years ago #

    I'm not the plugin author, but the only instance of fopen that I can find in the latest release is in html-importer.php:

    $contents = @fopen($path);  // read entire file
    if (empty($contents))
      $contents = @file_get_contents($path);

    I think the fopen fails, the at-sign suppresses the error message, and the file_get_contents actually reads the file.

  3. Stephanie Leary
    Plugin Author

    Posted 4 years ago #

    It doesn't specify a mode because on all the servers I tested on, I got nothing but errors.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • HTML Import 2
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic