Export filehandle bug

Help
2005-05-19
2013-05-28
  • There's a problem with the export_* functions in the refbase bibutils directory. They write out the temporary file, and then call the bibutils function _before_ closing the filehandle. In many cases the output isn't flushed and so xml2bib sees no data. Solution is to do the fclose as soon as you've written the file:

                   $tempFileHandle = fopen($tempFile, "w"); // open temp file with write permission
                    fwrite($tempFileHandle, $recordCollection); // save data to temp file
                    fclose($tempFileHandle); // close temp file

    In fact the three files export_xml2{bib,end,ris}.php are so similar they should be restructured!

    Anyway, they all have the same bug.

    The symptom is that you see a blank page when you export a record to a citation format.

     
    • Hi Barry,

      the problem you're describing was also mentioned by 'unfimaer' in the following thread:

      https://sourceforge.net/forum/forum.php?thread_id=1261670&forum_id=218758

      and I've fixed it already in the CVS version and it will thus be fixed in the next release version as well.

      I agree that some code in the three files is redundant and should be moved into a dedicated function. However, the current implementation requires that each export format resides in its own file and I actually think that this is a good thing.

      Matthias