PDA

View Full Version : [bug?] Superglobal variables are not superglobal


OCTAGRAM2
05-22-2011, 04:40 AM
Previously, I've managed to get PHP script running with Russian symbols by using binary collation in MySQL without turning on Unicode semantics.

Now I've decided to pick another way: Unicode in PHP.

I have faced a problem that can be deduced to the following example:

<?php

function test2_get() {
echo 'test2_get():<br />';
echo '$_GET = '.$_GET.'<br />';
echo '$_SERVER = '.$_SERVER.'<br />';
echo 'Normal array: '.array('abc' => 'def').'<br />';
}

function test3_get() {
global $_GET, $_SERVER;
echo 'test3_get():<br />';
echo '$_GET = '.$_GET.'<br />';
echo '$_SERVER = '.$_SERVER.'<br />';
echo 'Normal array: '.array('abc' => 'def').'<br />';
}

test2_get();
test3_get();

?>

As of Resin 4.0.18 it outputs

test2_get():
$_GET =
$_SERVER =
Normal array: Array
test3_get():
$_GET = Array
$_SERVER = Array
Normal array: Array

My WEB-INF/resin-web.xml:

<?xml version="1.0"?>
<web-app xmlns="http://caucho.com/ns/resin"
xmlns:sec="urn:java:com.caucho.security">

<servlet-mapping url-pattern="*.php"
servlet-class="com.caucho.quercus.servlet.QuercusServlet">
<init>
<compile>true</compile>
<database>jdbc/snipped</database>
<php-ini>
<unicode.semantics>on</unicode.semantics>
</php-ini>

</init>
</servlet-mapping>

<database>
<jndi-name>jdbc/megafonmagneto</jndi-name>
<driver>
<url>jdbc:mysql://localhost:3306/snipped?characterEncoding=utf8&amp;useUnicode=true</url>
<user>snipped</user>
<password>snipped</password>
<type>com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolD ataSource</type>
<useUnicode>true</useUnicode>
<characterEncoding>utf8</characterEncoding>
</driver>
</database>

</web-app>


BTW, that's the output of phpinfo():


PHP Version => 5.3.2
System => snipped
Build Date => 20110512T013903
Configure Command => n/a
Server API => CGI
Virtual Directory Support => disabled
Configuration File (php.ini) Path => null
PHP API => 20031224
PHP Extension => 20041030
Debug Build => no
Thread Safety => enabled
Registered PHP Streams => php, file, http, https


PHP Variables
Variable Value
_REQUEST

unicode(0) ""

_GET

unicode(0) ""

_POST

unicode(0) ""

_COOKIE

unicode(0) ""

_SESSION

unicode(0) ""

_ENV

unicode(0) ""

_SERVER

unicode(0) ""