#34253 [Opn]: COM binary object/array issue (question marks?)

2005-08-26 Thread inny at core dot fetchnet dot org
 ID:   34253
 User updated by:  inny at core dot fetchnet dot org
 Reported By:  inny at core dot fetchnet dot org
 Status:   Open
 Bug Type: COM related
 Operating System: Windows 2000
 PHP Version:  5.1.0RC1
 New Comment:

"Amusingly" enough, the array_reduce method didn't work for PHP5. I
guess that makes sense though.

-- Oh don't worry, I'm having lots of fun (on my own) in my own little
thread already.


Previous Comments:
----

[2005-08-26 11:16:57] inny at core dot fetchnet dot org

I was adding support for PHP4 to the script, which made me wonder: if
binary arrays are meant to be received like this, what would be the
fastest way to reformat them?

foreach ($content As $obj) {
// or foreach($content->value As $obj) in PHP4
  $image .= chr($obj);
}
echo($image);

or maybe something like

function rchr($v, $w) {
  $v .= chr($w);
  return($v);
}
$image = array_reduce($content, rchr);
// or $image = array_reduce($content->value, rchr); in PHP4

or something else?

Thanks.

----

[2005-08-25 18:37:36] inny at core dot fetchnet dot org

FYI, source of a now-operational version here:

http://demis.inny.org/temp/wms_working.php.txt

Non-operational script as .phps file:

http://demis.inny.org/temp/wms.phps

----

[2005-08-25 18:31:46] inny at core dot fetchnet dot org

Description:

I was translating the following script:
http://demis.inny.org/temp/wms.asp.txt
http://demis.inny.org/temp/wms.php.txt is a non-functional translation
I had at that time.

If $QueryString ($_SERVER['QUERY_STRING']) contained the proper
variables/values, the WMSServer would return a
byte-stream/array/whatever (I'm no genius at COM and such) containing a
map-image.

http://demis.inny.org/temp/wms.php.txt would return, instead of the
image, 8 question marks (). I solved this by changing
echo($content); into the following:

if (substr($contenttype, 0, 5) == 'image') {
  $image = null;
  foreach ($content As $obj) { // $obj will contain 1 byte each time,
echo'ing it would print a decimal which in turn represents an ASCII
value. hence chr();
$image .= chr($obj);
  }
  echo($image);
} else {
echo($content);
}

But this doesn't seem too resource-efficient to me (a run of foreach
for every byte), and I doubt it's an intended work-around (the ?'s
really got me puzzled, I'd have expected an error message).


Anyway, seeing as I needed to use chr(); with foreach, this seems
related to a fixed bug #15782: http://bugs.php.net/bug.php?id=15782

Maybe you were aware of all of this.. Maybe not. Cheers.

Reproduce code:
---
$WMSService = new COM("DemisWMSConnect.Service");
$MapServer = $WMSService->WMS($wms);

if (!is_object($MapServer)) {
dosomestuffand();
die();
} else {
$content = new VARIANT(null);
$contenttype = new VARIANT(null);
$return = $MapServer->WMSRequest($QueryString, $content,
$contenttype);
header('Content-type: '.$contenttype);
echo($content);
}






-- 
Edit this bug report at http://bugs.php.net/?id=34253&edit=1


#34253 [Opn]: COM binary object/array issue (question marks?)

2005-08-26 Thread inny at core dot fetchnet dot org
 ID:   34253
 User updated by:  inny at core dot fetchnet dot org
 Reported By:  inny at core dot fetchnet dot org
 Status:   Open
 Bug Type: COM related
 Operating System: Windows 2000
 PHP Version:  5.1.0RC1
 New Comment:

I was adding support for PHP4 to the script, which made me wonder: if
binary arrays are meant to be received like this, what would be the
fastest way to reformat them?

foreach ($content As $obj) {
// or foreach($content->value As $obj) in PHP4
  $image .= chr($obj);
}
echo($image);

or maybe something like

function rchr($v, $w) {
  $v .= chr($w);
  return($v);
}
$image = array_reduce($content, rchr);
// or $image = array_reduce($content->value, rchr); in PHP4

or something else?

Thanks.


Previous Comments:


[2005-08-25 18:37:36] inny at core dot fetchnet dot org

FYI, source of a now-operational version here:

http://demis.inny.org/temp/wms_working.php.txt

Non-operational script as .phps file:

http://demis.inny.org/temp/wms.phps



[2005-08-25 18:31:46] inny at core dot fetchnet dot org

Description:

I was translating the following script:
http://demis.inny.org/temp/wms.asp.txt
http://demis.inny.org/temp/wms.php.txt is a non-functional translation
I had at that time.

If $QueryString ($_SERVER['QUERY_STRING']) contained the proper
variables/values, the WMSServer would return a
byte-stream/array/whatever (I'm no genius at COM and such) containing a
map-image.

http://demis.inny.org/temp/wms.php.txt would return, instead of the
image, 8 question marks (). I solved this by changing
echo($content); into the following:

if (substr($contenttype, 0, 5) == 'image') {
  $image = null;
  foreach ($content As $obj) { // $obj will contain 1 byte each time,
echo'ing it would print a decimal which in turn represents an ASCII
value. hence chr();
$image .= chr($obj);
  }
  echo($image);
} else {
echo($content);
}

But this doesn't seem too resource-efficient to me (a run of foreach
for every byte), and I doubt it's an intended work-around (the ?'s
really got me puzzled, I'd have expected an error message).


Anyway, seeing as I needed to use chr(); with foreach, this seems
related to a fixed bug #15782: http://bugs.php.net/bug.php?id=15782

Maybe you were aware of all of this.. Maybe not. Cheers.

Reproduce code:
---
$WMSService = new COM("DemisWMSConnect.Service");
$MapServer = $WMSService->WMS($wms);

if (!is_object($MapServer)) {
dosomestuffand();
die();
} else {
$content = new VARIANT(null);
$contenttype = new VARIANT(null);
$return = $MapServer->WMSRequest($QueryString, $content,
$contenttype);
header('Content-type: '.$contenttype);
echo($content);
}






-- 
Edit this bug report at http://bugs.php.net/?id=34253&edit=1


#34253 [Opn]: COM binary object/array issue (question marks?)

2005-08-25 Thread inny at core dot fetchnet dot org
 ID:   34253
 User updated by:  inny at core dot fetchnet dot org
 Reported By:  inny at core dot fetchnet dot org
 Status:   Open
 Bug Type: COM related
 Operating System: Windows 2000
 PHP Version:  5.1.0RC1
 New Comment:

FYI, source of a now-operational version here:

http://demis.inny.org/temp/wms_working.php.txt

Non-operational script as .phps file:

http://demis.inny.org/temp/wms.phps


Previous Comments:


[2005-08-25 18:31:46] inny at core dot fetchnet dot org

Description:

I was translating the following script:
http://demis.inny.org/temp/wms.asp.txt
http://demis.inny.org/temp/wms.php.txt is a non-functional translation
I had at that time.

If $QueryString ($_SERVER['QUERY_STRING']) contained the proper
variables/values, the WMSServer would return a
byte-stream/array/whatever (I'm no genius at COM and such) containing a
map-image.

http://demis.inny.org/temp/wms.php.txt would return, instead of the
image, 8 question marks (). I solved this by changing
echo($content); into the following:

if (substr($contenttype, 0, 5) == 'image') {
  $image = null;
  foreach ($content As $obj) { // $obj will contain 1 byte each time,
echo'ing it would print a decimal which in turn represents an ASCII
value. hence chr();
$image .= chr($obj);
  }
  echo($image);
} else {
echo($content);
}

But this doesn't seem too resource-efficient to me (a run of foreach
for every byte), and I doubt it's an intended work-around (the ?'s
really got me puzzled, I'd have expected an error message).


Anyway, seeing as I needed to use chr(); with foreach, this seems
related to a fixed bug #15782: http://bugs.php.net/bug.php?id=15782

Maybe you were aware of all of this.. Maybe not. Cheers.

Reproduce code:
---
$WMSService = new COM("DemisWMSConnect.Service");
$MapServer = $WMSService->WMS($wms);

if (!is_object($MapServer)) {
dosomestuffand();
die();
} else {
$content = new VARIANT(null);
$contenttype = new VARIANT(null);
$return = $MapServer->WMSRequest($QueryString, $content,
$contenttype);
header('Content-type: '.$contenttype);
echo($content);
}






-- 
Edit this bug report at http://bugs.php.net/?id=34253&edit=1


#34253 [NEW]: COM binary object/array issue (question marks?)

2005-08-25 Thread inny at core dot fetchnet dot org
From: inny at core dot fetchnet dot org
Operating system: Windows 2000
PHP version:  5.1.0RC1
PHP Bug Type: COM related
Bug description:  COM binary object/array issue (question marks?)

Description:

I was translating the following script:
http://demis.inny.org/temp/wms.asp.txt
http://demis.inny.org/temp/wms.php.txt is a non-functional translation I
had at that time.

If $QueryString ($_SERVER['QUERY_STRING']) contained the proper
variables/values, the WMSServer would return a byte-stream/array/whatever
(I'm no genius at COM and such) containing a map-image.

http://demis.inny.org/temp/wms.php.txt would return, instead of the image,
8 question marks (). I solved this by changing echo($content); into
the following:

if (substr($contenttype, 0, 5) == 'image') {
  $image = null;
  foreach ($content As $obj) { // $obj will contain 1 byte each time,
echo'ing it would print a decimal which in turn represents an ASCII value.
hence chr();
$image .= chr($obj);
  }
  echo($image);
} else {
echo($content);
}

But this doesn't seem too resource-efficient to me (a run of foreach for
every byte), and I doubt it's an intended work-around (the ?'s really got
me puzzled, I'd have expected an error message).


Anyway, seeing as I needed to use chr(); with foreach, this seems related
to a fixed bug #15782: http://bugs.php.net/bug.php?id=15782

Maybe you were aware of all of this.. Maybe not. Cheers.

Reproduce code:
---
$WMSService = new COM("DemisWMSConnect.Service");
$MapServer = $WMSService->WMS($wms);

if (!is_object($MapServer)) {
dosomestuffand();
die();
} else {
$content = new VARIANT(null);
$contenttype = new VARIANT(null);
$return = $MapServer->WMSRequest($QueryString, $content, $contenttype);
header('Content-type: '.$contenttype);
echo($content);
}


-- 
Edit bug report at http://bugs.php.net/?id=34253&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34253&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34253&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34253&r=trysnapshot51
Fixed in CVS:http://bugs.php.net/fix.php?id=34253&r=fixedcvs
Fixed in release:http://bugs.php.net/fix.php?id=34253&r=alreadyfixed
Need backtrace:  http://bugs.php.net/fix.php?id=34253&r=needtrace
Need Reproduce Script:   http://bugs.php.net/fix.php?id=34253&r=needscript
Try newer version:   http://bugs.php.net/fix.php?id=34253&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34253&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=34253&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=34253&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=34253&r=submittedtwice
register_globals:http://bugs.php.net/fix.php?id=34253&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34253&r=php3
Daylight Savings:http://bugs.php.net/fix.php?id=34253&r=dst
IIS Stability:   http://bugs.php.net/fix.php?id=34253&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34253&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34253&r=float
No Zend Extensions:  http://bugs.php.net/fix.php?id=34253&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34253&r=mysqlcfg