Changeset 4004
- Timestamp:
- 07/06/2006 10:36:44 PM (19 years ago)
- Location:
- branches/2.0/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/wp-includes/gettext.php
r2882 r4004 62 62 */ 63 63 function readint() { 64 $stream = $this->STREAM->read(4);65 64 if ($this->BYTEORDER == 0) { 66 65 // low endian 67 $unpacked = unpack('V',$stream); 68 return array_shift($unpacked); 66 return array_shift(unpack('V', $this->STREAM->read(4))); 69 67 } else { 70 68 // big endian 71 $unpacked = unpack('N',$stream); 72 return array_shift($unpacked); 69 return array_shift(unpack('N', $this->STREAM->read(4))); 73 70 } 74 71 } … … 98 95 function gettext_reader($Reader, $enable_cache = true) { 99 96 // If there isn't a StreamReader, turn on short circuit mode. 100 if (! $Reader ) {97 if (! $Reader || isset($Reader->error) ) { 101 98 $this->short_circuit = true; 102 99 return; … … 106 103 $this->enable_cache = $enable_cache; 107 104 108 // $MAGIC1 = (int)0x950412de; //bug in PHP 5 105 // $MAGIC1 = (int)0x950412de; //bug in PHP 5.0.2, see https://savannah.nongnu.org/bugs/?func=detailitem&item_id=10565 109 106 $MAGIC1 = (int) - 1794895138; 110 107 // $MAGIC2 = (int)0xde120495; //bug … … 113 110 $this->STREAM = $Reader; 114 111 $magic = $this->readint(); 115 if ($magic == $MAGIC1) {112 if ($magic == ($MAGIC1 & 0xFFFFFFFF)) { // to make sure it works for 64-bit platforms 116 113 $this->BYTEORDER = 0; 117 } elseif ($magic == $MAGIC2) {114 } elseif ($magic == ($MAGIC2 & 0xFFFFFFFF)) { 118 115 $this->BYTEORDER = 1; 119 116 } else { … … 283 280 $header = $this->get_translation_string(0); 284 281 } 285 if (eregi("plural-forms: ( .*)\n", $header, $regs))282 if (eregi("plural-forms: ([^\n]*)\n", $header, $regs)) 286 283 $expr = $regs[1]; 287 284 else … … 309 306 310 307 eval("$string"); 311 if ($plural >= $total) $plural = 0;308 if ($plural >= $total) $plural = $total - 1; 312 309 return $plural; 313 310 } -
branches/2.0/wp-includes/streams.php
r2554 r4004 106 106 if ($bytes) { 107 107 fseek($this->_fd, $this->_pos); 108 $data = fread($this->_fd, $bytes); 108 109 // PHP 5.1.1 does not read more than 8192 bytes in one fread() 110 // the discussions at PHP Bugs suggest it's the intended behaviour 111 while ($bytes > 0) { 112 $chunk = fread($this->_fd, $bytes); 113 $data .= $chunk; 114 $bytes -= strlen($chunk); 115 } 109 116 $this->_pos = ftell($this->_fd); 110 117
Note: See TracChangeset
for help on using the changeset viewer.