|
Mantis - Quercus
|
|||||
| Viewing Issue Advanced Details | |||||
|
|
|||||
| ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
| 4568 | major | always | 05-20-11 10:56 | 12-30-12 00:17 | |
|
|
|||||
| Reporter: | thr | Platform: | |||
| Assigned To: | domdorn | OS: | |||
| Priority: | normal | OS Version: | |||
| Status: | closed | Product Version: | 4.0.14 | ||
| Product Build: | Resolution: | fixed | |||
| Projection: | none | ||||
| ETA: | none | Fixed in Version: | |||
|
|
|||||
| Summary: | 0004568: str_split fails with byte string | ||||
| Description: |
The application is reading a byte array from disc and trying to spilt it into an array of 8 bytes to unpack it later into int values. split_str returns correct sized array but does not set values after first array. This works in 'native' php (This technique is used in Wordpress 3 to read .mo translation files into memory). |
||||
| Steps To Reproduce: | |||||
| Additional Information: |
<?php $packed = pack("c*", 10,10,10,10,-64,8,1,10,77,2,0,0,63,8,1,0,1,2,3,4,5,6,7,8); print 'md5='.md5($packed).' '; $octets = str_split($packed, 8); for($o = 0; $o < count($octets); $o++) { print ' o='.$o.' '; $unpacked=unpack("c1n1/c1n2/c1n3/c1n4/c1n5/c1n6/c1n7/c1n8", $octets[$o]); var_dump($unpacked); } ?> In Quercus output is: md5=f13234affbcb2464158d99a131d1b001 o=0 array(8) { ["n1"]=> int(10) ["n2"]=> int(10) ["n3"]=> int(10) ["n4"]=> int(10) ["n5"]=> int(-64) ["n6"]=> int(8) ["n7"]=> int(1) ["n8"]=> int(10) } o=1 array(0) { } o=2 array(0) { } Native PHP output is: o=0 array(8) { ["n1"]=> int(10) ["n2"]=> int(10) ["n3"]=> int(10) ["n4"]=> int(10) ["n5"]=> int(-64) ["n6"]=> int(8) ["n7"]=> int(1) ["n8"]=> int(10) } o=1 array(8) { ["n1"]=> int(77) ["n2"]=> int(2) ["n3"]=> int(0) ["n4"]=> int(0) ["n5"]=> int(63) ["n6"]=> int(8) ["n7"]=> int(1) ["n8"]=> int(0) } o=2 array(8) { ["n1"]=> int(1) ["n2"]=> int(2) ["n3"]=> int(3) ["n4"]=> int(4) ["n5"]=> int(5) ["n6"]=> int(6) ["n7"]=> int(7) ["n8"]=> int(8) } |
||||
| Relationships | |||||
| Attached Files: |
|
||||
| Notes | |||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||