]> granicus.if.org Git - php/commitdiff
Internally-created array indices are unicode - fix tests to match
authorRasmus Lerdorf <rasmus@php.net>
Sun, 26 Jul 2009 08:38:01 +0000 (08:38 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Sun, 26 Jul 2009 08:38:01 +0000 (08:38 +0000)
ext/posix/posix.c
ext/posix/tests/posix_getgrgid.phpt
ext/posix/tests/posix_times.phpt
ext/posix/tests/posix_times_basic.phpt
ext/posix/tests/posix_uname.phpt

index 26eeaad10f56f5fc99095d368bf033e31c9039eb..23a8cb2400046fa583b2f54c50627f6be0c0bd24 100644 (file)
@@ -660,13 +660,13 @@ PHP_FUNCTION(posix_uname)
 
        array_init(return_value);
 
-       add_assoc_string(return_value, "sysname",  u.sysname,  1);
-       add_assoc_string(return_value, "nodename", u.nodename, 1);
-       add_assoc_string(return_value, "release",  u.release,  1);
-       add_assoc_string(return_value, "version",  u.version,  1);
-       add_assoc_string(return_value, "machine",  u.machine,  1);
+       add_ascii_assoc_string(return_value, "sysname",  u.sysname,  1);
+       add_ascii_assoc_string(return_value, "nodename", u.nodename, 1);
+       add_ascii_assoc_string(return_value, "release",  u.release,  1);
+       add_ascii_assoc_string(return_value, "version",  u.version,  1);
+       add_ascii_assoc_string(return_value, "machine",  u.machine,  1);
 #if defined(_GNU_SOURCE) && !defined(DARWIN) && defined(HAVE_UTSNAME_DOMAINNAME)
-       add_assoc_string(return_value, "domainname", u.domainname, 1);
+       add_ascii_assoc_string(return_value, "domainname", u.domainname, 1);
 #endif
 }
 /* }}} */
@@ -691,11 +691,11 @@ PHP_FUNCTION(posix_times)
 
        array_init(return_value);
 
-       add_assoc_long(return_value, "ticks",   ticks);                 /* clock ticks */
-       add_assoc_long(return_value, "utime",   t.tms_utime);   /* user time */
-       add_assoc_long(return_value, "stime",   t.tms_stime);   /* system time */
-       add_assoc_long(return_value, "cutime",  t.tms_cutime);  /* user time of children */
-       add_assoc_long(return_value, "cstime",  t.tms_cstime);  /* system time of children */
+       add_ascii_assoc_long(return_value, "ticks",     ticks);                 /* clock ticks */
+       add_ascii_assoc_long(return_value, "utime",     t.tms_utime);   /* user time */
+       add_ascii_assoc_long(return_value, "stime",     t.tms_stime);   /* system time */
+       add_ascii_assoc_long(return_value, "cutime",    t.tms_cutime);  /* user time of children */
+       add_ascii_assoc_long(return_value, "cstime",    t.tms_cstime);  /* system time of children */
 }
 /* }}} */
 
@@ -953,13 +953,13 @@ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */
        MAKE_STD_ZVAL(array_members);
        array_init(array_members);
        
-       add_assoc_string(array_group, "name", g->gr_name, 1);
-       add_assoc_string(array_group, "passwd", g->gr_passwd, 1);
+       add_ascii_assoc_string(array_group, "name", g->gr_name, 1);
+       add_ascii_assoc_string(array_group, "passwd", g->gr_passwd, 1);
        for (count=0; g->gr_mem[count] != NULL; count++) {
                add_next_index_string(array_members, g->gr_mem[count], 1);
        }
-       zend_hash_update(Z_ARRVAL_P(array_group), "members", sizeof("members"), (void*)&array_members, sizeof(zval*), NULL);
-       add_assoc_long(array_group, "gid", g->gr_gid);
+       zend_ascii_hash_update(Z_ARRVAL_P(array_group), "members", sizeof("members"), (void*)&array_members, sizeof(zval*), NULL);
+       add_ascii_assoc_long(array_group, "gid", g->gr_gid);
        return 1;
 }
 /* }}} */
@@ -1122,13 +1122,13 @@ int php_posix_passwd_to_array(struct passwd *pw, zval *return_value) /* {{{ */
        if (NULL == return_value || Z_TYPE_P(return_value) != IS_ARRAY)
                return 0;
 
-       add_assoc_string(return_value, "name",      pw->pw_name, 1);
-       add_assoc_string(return_value, "passwd",    pw->pw_passwd, 1);
-       add_assoc_long  (return_value, "uid",       pw->pw_uid);
-       add_assoc_long  (return_value, "gid",           pw->pw_gid);
-       add_assoc_string(return_value, "gecos",     pw->pw_gecos, 1);
-       add_assoc_string(return_value, "dir",       pw->pw_dir, 1);
-       add_assoc_string(return_value, "shell",     pw->pw_shell, 1);
+       add_ascii_assoc_string(return_value, "name",      pw->pw_name, 1);
+       add_ascii_assoc_string(return_value, "passwd",    pw->pw_passwd, 1);
+       add_ascii_assoc_long  (return_value, "uid",       pw->pw_uid);
+       add_ascii_assoc_long  (return_value, "gid",             pw->pw_gid);
+       add_ascii_assoc_string(return_value, "gecos",     pw->pw_gecos, 1);
+       add_ascii_assoc_string(return_value, "dir",       pw->pw_dir, 1);
+       add_ascii_assoc_string(return_value, "shell",     pw->pw_shell, 1);
        return 1;
 }
 /* }}} */
@@ -1256,15 +1256,15 @@ static int posix_addlimit(int limit, char *name, zval *return_value TSRMLS_DC)
        }
 
        if (rl.rlim_cur == RLIM_INFINITY) {
-               add_assoc_stringl(return_value, soft, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1, 1);
+               add_ascii_assoc_stringl(return_value, soft, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1, 1);
        } else {
-               add_assoc_long(return_value, soft, rl.rlim_cur);
+               add_ascii_assoc_long(return_value, soft, rl.rlim_cur);
        }
 
        if (rl.rlim_max == RLIM_INFINITY) {
-               add_assoc_stringl(return_value, hard, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1, 1);
+               add_ascii_assoc_stringl(return_value, hard, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1, 1);
        } else {
-               add_assoc_long(return_value, hard, rl.rlim_max);
+               add_ascii_assoc_long(return_value, hard, rl.rlim_max);
        }
 
        return SUCCESS;
index 139c9bdec374f0546be25e36745adb45524f2d10..0209d09732c50f3e51bc916298133839d956738d 100644 (file)
@@ -12,19 +12,19 @@ if (!extension_loaded('posix')) {
 --FILE--
 <?php
 $grp = posix_getgrgid(0);
-if (!isset($grp[b'name'])) {
+if (!isset($grp['name'])) {
     die('Array index "name" does not exist.');
 }
-if (!isset($grp[b'passwd'])) {
+if (!isset($grp['passwd'])) {
     die('Array index "passwd" does not exist.');
 }
-if (!isset($grp[b'members'])) {
+if (!isset($grp['members'])) {
     die('Array index "members" does not exist.');
-} elseif (!is_array($grp[b'members'])) {
+} elseif (!is_array($grp['members'])) {
     die('Array index "members" must be an array.');
 } else {
-    if (count($grp[b'members']) > 0) {
-        foreach ($grp[b'members'] as $idx => $username) {
+    if (count($grp['members']) > 0) {
+        foreach ($grp['members'] as $idx => $username) {
             if (!is_int($idx)) {
                 die('Index in members Array is not an int.');
             }
@@ -34,10 +34,10 @@ if (!isset($grp[b'members'])) {
         }
     }
 }
-if (!isset($grp[b'gid'])) {
+if (!isset($grp['gid'])) {
     die('Array index "gid" does not exist.');
 }
-var_dump($grp[b'gid']);
+var_dump($grp['gid']);
 ?>
 ===DONE===
 --EXPECT--
index 6ad3407ccb063596ac6dc1629109b1c1c8454978..f57363ea0bc03403706ca0dff75a283ad24d318f 100644 (file)
@@ -19,15 +19,15 @@ PHP Testfest Berlin 2009-05-10
 ===DONE===
 --EXPECTF--
 array(5) {
-  ["ticks"]=>
+  [u"ticks"]=>
   int(%i)
-  ["utime"]=>
+  [u"utime"]=>
   int(%d)
-  ["stime"]=>
+  [u"stime"]=>
   int(%d)
-  ["cutime"]=>
+  [u"cutime"]=>
   int(%d)
-  ["cstime"]=>
+  [u"cstime"]=>
   int(%d)
 }
 ===DONE===
index eb8af10df4092f41cb93dc82b1555bc05e360db9..b761b36a19145a525fc5179a1d1190cec857bffe 100644 (file)
@@ -23,15 +23,15 @@ Test posix_times() function : basic functionality
 --EXPECTF--
 Basic test of POSIX times function
 array(5) {
-  ["ticks"]=>
+  [u"ticks"]=>
   int(%d)
-  ["utime"]=>
+  [u"utime"]=>
   int(%d)
-  ["stime"]=>
+  [u"stime"]=>
   int(%d)
-  ["cutime"]=>
+  [u"cutime"]=>
   int(%d)
-  ["cstime"]=>
+  [u"cstime"]=>
   int(%d)
 }
 ===DONE====
index 12c4baec16760b73df1f3ac698419c0fb9b865c9..14bf89104f41573758af10e8df2064bd3c80fc7e 100644 (file)
@@ -19,15 +19,15 @@ PHP Testfest Berlin 2009-05-10
 ===DONE===
 --EXPECTF--
 array(5) {
-  ["sysname"]=>
+  [u"sysname"]=>
   string(%d) "%s"
-  ["nodename"]=>
+  [u"nodename"]=>
   string(%d) "%s"
-  ["release"]=>
+  [u"release"]=>
   string(%d) "%s"
-  ["version"]=>
+  [u"version"]=>
   string(%d) "%s"
-  ["machine"]=>
+  [u"machine"]=>
   string(%d) "%s"
 }
 ===DONE===