rasmus Sun, 26 Jul 2009 08:38:01 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=286354
Log:
Internally-created array indices are unicode - fix tests to match
Changed paths:
U php/php-src/trunk/ext/posix/posix.c
U php/php-src/trunk/ext/posix/tests/posix_getgrgid.phpt
U php/php-src/trunk/ext/posix/tests/posix_times.phpt
U php/php-src/trunk/ext/posix/tests/posix_times_basic.phpt
U php/php-src/trunk/ext/posix/tests/posix_uname.phpt
Modified: php/php-src/trunk/ext/posix/posix.c
===================================================================
--- php/php-src/trunk/ext/posix/posix.c 2009-07-26 08:13:40 UTC (rev 286353)
+++ php/php-src/trunk/ext/posix/posix.c 2009-07-26 08:38:01 UTC (rev 286354)
@@ -660,13 +660,13 @@
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 @@
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 @@
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 @@
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 @@
}
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;
Modified: php/php-src/trunk/ext/posix/tests/posix_getgrgid.phpt
===================================================================
--- php/php-src/trunk/ext/posix/tests/posix_getgrgid.phpt 2009-07-26
08:13:40 UTC (rev 286353)
+++ php/php-src/trunk/ext/posix/tests/posix_getgrgid.phpt 2009-07-26
08:38:01 UTC (rev 286354)
@@ -12,19 +12,19 @@
--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'gid'])) {
+if (!isset($grp['gid'])) {
die('Array index "gid" does not exist.');
}
-var_dump($grp[b'gid']);
+var_dump($grp['gid']);
?>
===DONE===
--EXPECT--
Modified: php/php-src/trunk/ext/posix/tests/posix_times.phpt
===================================================================
--- php/php-src/trunk/ext/posix/tests/posix_times.phpt 2009-07-26 08:13:40 UTC
(rev 286353)
+++ php/php-src/trunk/ext/posix/tests/posix_times.phpt 2009-07-26 08:38:01 UTC
(rev 286354)
@@ -19,15 +19,15 @@
===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===
Modified: php/php-src/trunk/ext/posix/tests/posix_times_basic.phpt
===================================================================
--- php/php-src/trunk/ext/posix/tests/posix_times_basic.phpt 2009-07-26
08:13:40 UTC (rev 286353)
+++ php/php-src/trunk/ext/posix/tests/posix_times_basic.phpt 2009-07-26
08:38:01 UTC (rev 286354)
@@ -23,15 +23,15 @@
--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====
Modified: php/php-src/trunk/ext/posix/tests/posix_uname.phpt
===================================================================
--- php/php-src/trunk/ext/posix/tests/posix_uname.phpt 2009-07-26 08:13:40 UTC
(rev 286353)
+++ php/php-src/trunk/ext/posix/tests/posix_uname.phpt 2009-07-26 08:38:01 UTC
(rev 286354)
@@ -19,15 +19,15 @@
===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===
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php