From: rauf at ug dot bcc dot bilkent dot edu dot tr
Operating system: Windows 2000
PHP version: 4.3.1
PHP Bug Type: Unknown/Other Function
Bug description: printer_write() doesn't work when you manipulate on text to be
written
This function (printer_write()) runs perfectly when i use the following:
ob_start();
/* put some data on the screen ?/
echo("some text to be written\n");
echo("some other text to be written\n");
echo("another text to be written\n");
$handle = printer_open("Panasonic KX-P1150");
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_set_option($handle, PRINTER_COPIES, 1);
$string = ob_get_contents();
/* I'm using the data on the screen buffer */
printer_write($handle, $string);
printer_close($handle);
I have the following error message when i use the following code:
Warning: couldn't allocate the printerjob [1804] in c:\apache\htdocs\...
on line 148
the code is:
----------------
ob_start();
/* put some data on the screen ?/
echo("some text to be written\n");
echo("some other text to be written\n");
echo("another text to be written\n");
$handle = printer_open("Panasonic KX-P1150");
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_set_option($handle, PRINTER_COPIES, 1);
$string = ob_get_contents();
/* I'm using the data on the screen buffer */
replaceTurkish($string)
/* this time i'm using this function that replaces
the Turkish characters with the English ones.
The function is given below */
printer_write($handle, $string);
printer_close($handle);
--------------------
function replaceTurkish(&$text)
{
$text = str_replace("�", "G", $text);
$text = str_replace("�", "U", $text);
$text = str_replace("�", "S", $text);
$text = str_replace("�", "I", $text);
$text = str_replace("�", "O", $text);
$text = str_replace("�", "C", $text);
$text = str_replace("�", "g", $text);
$text = str_replace("�", "u", $text);
$text = str_replace("�", "s", $text);
$text = str_replace("�", "i", $text);
$text = str_replace("�", "o", $text);
$text = str_replace("�", "c", $text);
}
----------------------------------
The same error occurs when I use:
printer_write($handle, "$string");
instead of
printer_write($handle, $string);
-----------------------------------
I've seen some similar bug reports closed because of the PHP version is
too old. I used the latest stable version but the same problem occurs.
--
Edit bug report at http://bugs.php.net/?id=22668&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=22668&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=22668&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=22668&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=22668&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=22668&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=22668&r=support
Expected behavior: http://bugs.php.net/fix.php?id=22668&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=22668&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=22668&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=22668&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22668&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=22668&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=22668&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=22668&r=gnused