Package: php-gettext
Version: 1.0.7-6
Severity: normal
Tags: patch

When included in a project that uses strict error checking (don't know
how may php projects do), the library fails out in a couple of places.
For example:

E_STRICT: Creating default object from empty value
in /usr/share/php/php-gettext/gettext.inc on line 154

The following patch clears up the warnings (albeit with slightly odd
indentation).

--- gettext/usr/share/php/php-gettext/gettext.inc       2006-02-07 
20:43:11.000000000 +0000
+++ /usr/share/php/php-gettext/gettext.inc      2008-07-31 14:22:36.000000000 
+0100
@@ -44,6 +44,12 @@
 $EMULATEGETTEXT = 0;
 $CURRENTLOCALE = '';

+class domain
+{
+  var $l10n;
+  var $path;
+  var $codeset;
+}

 // Utility functions

@@ -64,6 +70,10 @@
                else {
                        $input = null;
                }
+    if (!array_key_exists($domain, $text_domains))
+    {
+      $text_domains[$domain] = new domain();
+    }
                $text_domains[$domain]->l10n = new gettext_reader($input, 
$enable_cache);
        }
        return $text_domains[$domain]->l10n;
@@ -151,6 +161,10 @@
        // ensure $path ends with a slash
        if ($path[strlen($path) - 1] != '/') $path .= '/';
        elseif ($path[strlen($path) - 1] != '\\') $path .= '\\';
+  if (!array_key_exists($domain, $text_domains))
+  {
+    $text_domains[$domain] = new domain();
+  }
        $text_domains[$domain]->path = $path;
 }

@@ -166,8 +180,12 @@
  * Sets the default domain.
  */
 function _textdomain($domain) {
-       global $default_domain;
+       global $default_domain, $text_domains;
        $default_domain = $domain;
+  if (!array_key_exists($domain, $text_domains))
+  {
+    $text_domains[$domain] = new domain();
+  }
 }

 /**
@@ -315,4 +333,4 @@
        }
 }

-?>
\ No newline at end of file
+?>
--- gettext/usr/share/php/php-gettext/gettext.php       2006-02-02 
19:04:02.000000000 +0000
+++ /usr/share/php/php-gettext/gettext.php      2008-07-31 12:13:50.000000000 
+0100
@@ -63,10 +63,12 @@
   function readint() {
       if ($this->BYTEORDER == 0) {
         // low endian
-        return array_shift(unpack('V', $this->STREAM->read(4)));
+        $unpacked = unpack('V', $this->STREAM->read(4));
+        return array_shift($unpacked);
       } else {
         // big endian
-        return array_shift(unpack('N', $this->STREAM->read(4)));
+        $unpacked = unpack('N', $this->STREAM->read(4));
+        return array_shift($unpacked);
       }
     }

--- gettext/usr/share/php/php-gettext/streams.php       2006-02-02 
19:59:18.000000000 +0000
+++ /usr/share/php/php-gettext/streams.php      2008-07-31 12:07:57.000000000 
+0100
@@ -105,6 +105,7 @@
   function read($bytes) {
     if ($bytes) {
       fseek($this->_fd, $this->_pos);
+      $data = '';

       // PHP 5.1.1 does not read more than 8192 bytes in one fread()
       // the discussions at PHP Bugs suggest it's the intended behaviour
@@ -163,4 +164,4 @@
 }


-?>
\ No newline at end of file
+?>


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-486
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages php-gettext depends on:
ii  php5                          5.2.6-2    server-side, HTML-embedded scripti

php-gettext recommends no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to