PHP Feed

Feb 05, 2010

PHP Syslog Patch for Windows (2)

We published a patch that makes PHP to send UTF-8 strings to eventlog on Windows. It works well, but the patch is only applicable when your PHP's 'mbstring.internal_encoding' is UTF-8. This means there are some limitations against general use.

We have improved that patch by introducing a new INI directive that enables/disables wide character conversion of syslog messages; the directive name is 'syslog_widechar'.  Here is a sample usage with two simple PHP scripts.

sample1:

<?php
$message = SOME_UTF8_STRING;
// syslog(LOG_WARNING, $message); // this does not work
ini_set("syslog_widechar", true); // our new directive
syslog(LOG_WARNING, $message);    // this works

sample2:

<?php
$message = SOME_ISO_2022_JP_STRING;
syslog(LOG_WARNING, $message);    // this works
ini_set("syslog_widechar", true); // our new directive

// syslog(LOG_WARNING, $message); // this does not work
syslog(LOG_WARNING, mb_convert_encoding($message, "UTF-8", "ISO-2022-JP")); // this works

After running these scripts using PHP with this patch, you can see the event messages without any corruptions in Event Viewer.  This patch applies cleanly to PHP-5.3.1.

Download: php_syslog-2.patch

--
KITAZAKI Shigeru

Jan 28, 2010

GB18030 support for PHP5.3

GB18030 is the new Chinese standard character encoding that every software in China needs to support.  However, the current PHP5.3 does not support it.

This patch adds GB18030 support to libmbfl, a unicode string library embedded and used in PHP.  The patch applies cleanly to PHP-5.3.1.

Download: libmbfl_gb18030.patch

---
KITAZAKI Shigeru

Jan 27, 2010

PHP Native LDAP Patch for Windows

Current version of PHP uses OpenLDAP client library on Windows, even though OpenLDAP has dropped Windows support.

We made a patch to let PHP use Windows native LDAP API instead of OpenLDAP. This patch applies cleanly to PHP version 5.3.1.

Download: php_ldap.patch

---
HOSHINO Takashi

Jan 21, 2010

PHP Syslog Patch for Windows

WARNING: This patch is only applicable when your PHP's mbstring.internal_encoding is UTF-8.

The current implementation of PHP's syslog() function cannot properly send UTF-8 strings to eventlog because it uses ReportEventA().  This patch translates UTF-8 internal encoding into WCHAR (UTF-16) and sends it using ReportEventW() to avoid string corruptions.

In addition, the current implementation maps LOG_ERR severity to eventlog's warning level, which I think misguided.  This patch changes the mapping of LOG_ERR to eventlog's error.

Download: php_syslog.patch

--
YAMAMOTO Hirotaka (tnnrg)

Jan 20, 2010

Spidermonkey PHP Extension patches

There are three patches to enhance or fix bugs of Spidermonkey PHP Extension.
This patches are for spidermonkey-0.1.3.tgz from the official web site:
http://pecl.php.net/package/spidermonkey

The patches must be applied in the following order.

(1) spidermonkey-windows.patch
Support windows build of the extension.
Specify --with-spidermonkey=${SPIDERMONKEY_INSTALLED_DIRECTORY} as configure option.
Currently shared library build is not supported.

(2) spidermonkey-line-number.patch
Print not only line number but also specified string text when an error occurs in interpreting javascript code. Specify a prefer string to the second argument of evaluateScript() function. It will help your debug javascript code in PHP. Of course it can be omitted.

(3) spidermonkey-empty-string.patch
This fixes PECL Bug #16876.

---
HOSHINO Takashi