• 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.

    http://wordpress.org/extend/plugins/import-html-pages/

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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.

    Plugin Author Stephanie Leary

    (@sillybean)

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: HTML Import 2] Fopen mode not specified’ is closed to new replies.