Jeffry Killen wrote: > I was having problems with ZipArchive->open(<file name>, > ZipArchive::CREATE) > returning error code 1 (multidisc archives not supported) in various > circumstances. > > This seems to make a subtle but important difference > $zipper = new ZipArchive(); > $ret = $zipper->open('some.zip', ZipArchive::CREATE) > > the dfference: > If($ret > 0)// look for an int representing an err code > { > // but no legitimate err is returned by open > // I get the multidisc not supported error and the zip file is not > created > // this seems to imply that 'true' is being evaluated as 1 Ah, of course! What happens is described in the comparision manual[1]. In this case both operands are converted to boolean, so the expression becomes TRUE > FALSE, what is true. A simple and reliable way for debugging purposes: use var_dump() to print a value, e.g. var_dump($ret); > } > > if($ret !== true) > { > // when no legitimate err code is returned by open > // test fails and the zip file is created. > } > > I have been getting the error 1 code on three different Mac OSX based > servers. > I finally decided to resurrect one of my home built machines and install > FreeBSD v10.1 > I did that and went through the laborious processes of adding apache/php > to it > and migrating the relevant dev work to it, only to find the same problem. You do not necessarily have to install Apache and configure it for some testing. As of 5.4, PHP has a built-in web server which is fine for many simple tasks. For details refer to its man page[2]. And at least for some quick tests you can also use the command line interface directly[3]. > So I had to get inventive > > I hope this will be a relief to anyone with anxieties about it (it is > for me) Thanks for the follow up! :) [1] <http://php.net/manual/en/language.operators.comparison.php#language.operators.comparison.types> [2] <http://php.net/manual/en/features.commandline.webserver.php> [3] <http://php.net/manual/en/features.commandline.usage.php> -- Christoph M. Becker -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php