Hello! I don't really have an answer except that according to the source here:
http://lxr.php.net/source/pecl/printer/printer.c#256 It can return false but also has a chance to return nothing which doesn't seem like a good idea. That is, if the following condition fails nothing happens: if (DocumentProperties(NULL, resource->handle, resource->name, resource->pi2->pDevMode, NULL, DM_OUT_BUFFER) == IDOK) { I have no idea what this means but I consider this a PHP bug, not a documentation bug. I suggest you open up a bug report for this extension. I'm not sure how to report it though considering this extension is PECL yet cannot be found at pecl.php.net so I guess that's a bug too :) Once fixed, we'll document the change (I added a user comment for now). Quick fix: Just know that it may return NULL or FALSE so using a strict type check may not be the best route here. Regards, Philip On Wed, 30 Mar 2005, Greg Jackson wrote: > Hi > > I'm not sure if this is a documentation error or a bug in php_printer.dll > but here goes... > > printer_open() is returning NULL upon failure, not FALSE i.e. the following > code doesn't work: > > <?php > $printer = "\\\\greg-mac\\LaserJet_5"; > if(($conn_printer = printer_open($printer)) === FALSE) > die("Could not connect to $printer\r\n"); > var_dump($conn_printer); > printer_close($conn_printer); > ?> > > This does: > > <?php > $printer = "\\\\greg-mac\\LaserJet_5"; > if(($conn_printer = printer_open($printer)) === NULL) > die("Could not connect to $printer\r\n"); > var_dump($conn_printer); > printer_close($conn_printer); > ?> > > Version info: > > PHP 4.3.10 (cli) (built: Dec 14 2004 17:48:04) > php_printer.dll 29-Mar-2005 16:28 40k > > > Best regards, > Greg Jackson > Web Administrator > > Active Components (NZ) Ltd > PO Box 100-544, Auckland > New Zealand > > DDI: +64-9-443 9519 > Sales: +64-9-443 9500 > Fax: +64-9-443 9502 > http://www.activecomponents.com/ >
