For my BBify'r (http://omniurl.tk/9167/199763/) project, I made a short PHP snippet to open a TNS file as a ZIP archive and read the contents of Problem1.xml. Following the rough description on Hackspire's page on the [hackspire]TNS File Format[/hackspire], I replaced the first ten bytes (*TIMLP followed by four version bytes) with \x50\x4B\x03\x04 and then used ZipArchive (http://www.php.net/manual/en/class.ziparchive.php) to open it. Unfortunately, it didn't work, and ZipArchive didn't even give me an error.
What surprised me was that I had been able to do that with 7-zip before with no problems (using XVI32 to change the first few bytes). But since GUI apps all have a habit of pretending nothing happened when an error occurs, I decided to try it with the command-line unzip command, and here's what it gave me:warning [cube.tns.txt]: 362 extra bytes at beginning or within zipfile
(attempting to process anyway)
inflating: Problem1.xml
So apparently there is an error, and it's insignificant enough that unzip and 7-zip pass by with no problem, but large enough that ZipArchive stumbles.
Does anyone know what it is? Hackspire mentions nothing of the sort, but it seems outdated anyway (it says the only version numbers known are 0120, 0200, and 0300, while I'm working with a file with version number 0500). For now, I'm cheating in my script and using exec (http://www.php.net/manual/en/function.exec.php) to run unzip on the uploaded file, but if possible I'd like to take that bit out and replace it with native PHP/ZipArchive. Thanks for any help!