TestExtVariable -> php
Esse commit está contido em:
@@ -48,7 +48,6 @@
|
||||
#include "hphp/test/ext/test_ext_session.h"
|
||||
#include "hphp/test/ext/test_ext_soap.h"
|
||||
#include "hphp/test/ext/test_ext_sqlite3.h"
|
||||
#include "hphp/test/ext/test_ext_variable.h"
|
||||
#include "hphp/test/ext/test_ext_zlib.h"
|
||||
|
||||
#endif // incl_EXT_LIST_TEST_EXT_H_
|
||||
|
||||
@@ -1,408 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| HipHop for PHP |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/test/ext/test_ext_variable.h"
|
||||
#include "hphp/runtime/ext/ext_variable.h"
|
||||
#include "hphp/runtime/ext/ext_string.h"
|
||||
#include "hphp/system/systemlib.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtVariable::RunTests(const std::string &which) {
|
||||
bool ret = true;
|
||||
|
||||
DECLARE_TEST_FUNCTIONS("");
|
||||
|
||||
RUN_TEST(test_is_bool);
|
||||
RUN_TEST(test_is_int);
|
||||
RUN_TEST(test_is_integer);
|
||||
RUN_TEST(test_is_long);
|
||||
RUN_TEST(test_is_double);
|
||||
RUN_TEST(test_is_float);
|
||||
RUN_TEST(test_is_numeric);
|
||||
RUN_TEST(test_is_real);
|
||||
RUN_TEST(test_is_string);
|
||||
RUN_TEST(test_is_scalar);
|
||||
RUN_TEST(test_is_array);
|
||||
RUN_TEST(test_is_object);
|
||||
RUN_TEST(test_is_resource);
|
||||
RUN_TEST(test_is_null);
|
||||
RUN_TEST(test_gettype);
|
||||
RUN_TEST(test_get_resource_type);
|
||||
RUN_TEST(test_intval);
|
||||
RUN_TEST(test_doubleval);
|
||||
RUN_TEST(test_floatval);
|
||||
RUN_TEST(test_strval);
|
||||
RUN_TEST(test_settype);
|
||||
RUN_TEST(test_print_r);
|
||||
RUN_TEST(test_var_export);
|
||||
RUN_TEST(test_var_dump);
|
||||
RUN_TEST(test_debug_zval_dump);
|
||||
RUN_TEST(test_serialize);
|
||||
RUN_TEST(test_unserialize);
|
||||
RUN_TEST(test_get_defined_vars);
|
||||
RUN_TEST(test_import_request_variables);
|
||||
RUN_TEST(test_extract);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtVariable::test_is_bool() {
|
||||
VERIFY(f_is_bool(true));
|
||||
VERIFY(!f_is_bool("test"));
|
||||
VERIFY(f_is_bool(Variant(true)));
|
||||
VERIFY(!f_is_bool(Variant("test")));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_is_int() {
|
||||
VERIFY(f_is_int(123));
|
||||
VERIFY(!f_is_int("123"));
|
||||
VERIFY(f_is_int(Variant(123)));
|
||||
VERIFY(!f_is_int(Variant("123")));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_is_integer() {
|
||||
VERIFY(f_is_integer(123));
|
||||
VERIFY(!f_is_integer("123"));
|
||||
VERIFY(f_is_integer(Variant(123)));
|
||||
VERIFY(!f_is_integer(Variant("123")));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_is_long() {
|
||||
VERIFY(f_is_long(123));
|
||||
VERIFY(!f_is_long("123"));
|
||||
VERIFY(f_is_long(Variant(123)));
|
||||
VERIFY(!f_is_long(Variant("123")));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_is_double() {
|
||||
VERIFY(f_is_double(123.4));
|
||||
VERIFY(!f_is_double("123.4"));
|
||||
VERIFY(f_is_double(Variant(123.4)));
|
||||
VERIFY(!f_is_double(Variant("123.4")));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_is_float() {
|
||||
VERIFY(f_is_float(123.4));
|
||||
VERIFY(!f_is_float("123.4"));
|
||||
VERIFY(f_is_float(Variant(123.4)));
|
||||
VERIFY(!f_is_float(Variant("123.4")));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_is_numeric() {
|
||||
VERIFY(f_is_numeric(123));
|
||||
VERIFY(f_is_numeric("123.4"));
|
||||
VERIFY(!f_is_numeric("e123.4"));
|
||||
VERIFY(f_is_numeric(Variant(123)));
|
||||
VERIFY(f_is_numeric(Variant("123.4")));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_is_real() {
|
||||
VERIFY(f_is_real(123.4));
|
||||
VERIFY(!f_is_real("123.4"));
|
||||
VERIFY(f_is_real(Variant(123.4)));
|
||||
VERIFY(!f_is_real(Variant("123.4")));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_is_string() {
|
||||
VERIFY(!f_is_string(123));
|
||||
VERIFY(f_is_string("test"));
|
||||
VERIFY(f_is_string(String("test")));
|
||||
VERIFY(f_is_string(Variant("test")));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_is_scalar() {
|
||||
VERIFY(f_is_scalar(123));
|
||||
VERIFY(f_is_scalar("test"));
|
||||
VERIFY(!f_is_scalar(uninit_null()));
|
||||
VERIFY(!f_is_scalar(CREATE_VECTOR1(123)));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_is_array() {
|
||||
VERIFY(!f_is_array(123));
|
||||
VERIFY(!f_is_array("test"));
|
||||
VERIFY(f_is_array(CREATE_VECTOR1(123)));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_is_object() {
|
||||
VERIFY(!f_is_object(123));
|
||||
VERIFY(!f_is_object("test"));
|
||||
VERIFY(f_is_object(Object(SystemLib::AllocStdClassObject())));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
static StaticString s_TestResource("TestResource");
|
||||
|
||||
class TestResource : public ResourceData {
|
||||
public:
|
||||
// overriding ResourceData
|
||||
CStrRef o_getClassNameHook() const { return s_TestResource; }
|
||||
};
|
||||
|
||||
bool TestExtVariable::test_is_resource() {
|
||||
VERIFY(!f_is_resource(123));
|
||||
VERIFY(!f_is_resource("test"));
|
||||
VERIFY(f_is_resource(Object(new TestResource())));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_is_null() {
|
||||
VERIFY(!f_is_null(0));
|
||||
VERIFY(!f_is_null(""));
|
||||
VERIFY(f_is_null(String()));
|
||||
VERIFY(f_is_null(Array()));
|
||||
VERIFY(f_is_null(Object()));
|
||||
VERIFY(f_is_null(Variant()));
|
||||
VERIFY(f_is_null(uninit_null()));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_gettype() {
|
||||
VS(f_gettype(uninit_null()), "NULL");
|
||||
VS(f_gettype(0), "integer");
|
||||
VS(f_gettype("test"), "string");
|
||||
VS(f_gettype(String("hi")), "string");
|
||||
VS(f_gettype(Array::Create()), "array");
|
||||
VS(f_gettype(Object(SystemLib::AllocStdClassObject())), "object");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_get_resource_type() {
|
||||
VS(f_get_resource_type(Object(new TestResource())), "TestResource");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_intval() {
|
||||
VS(f_intval("12"), 12);
|
||||
VS(f_intval("12", 8), 10);
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_doubleval() {
|
||||
VS(f_doubleval("12.3"), 12.3);
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_floatval() {
|
||||
VS(f_floatval("12.3"), 12.3);
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_strval() {
|
||||
VS(f_strval(123), "123");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_settype() {
|
||||
{
|
||||
Variant v = "5bar";
|
||||
VERIFY(f_settype(ref(v), "integer"));
|
||||
VS(v, 5);
|
||||
}
|
||||
{
|
||||
Variant v = true;
|
||||
VERIFY(f_settype(ref(v), "string"));
|
||||
VS(v, "1");
|
||||
}
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_print_r() {
|
||||
Variant v = CREATE_MAP3("a","apple","b",2,"c",CREATE_VECTOR3(1,"y",3));
|
||||
VS(f_print_r(v, true),
|
||||
"Array\n"
|
||||
"(\n"
|
||||
" [a] => apple\n"
|
||||
" [b] => 2\n"
|
||||
" [c] => Array\n"
|
||||
" (\n"
|
||||
" [0] => 1\n"
|
||||
" [1] => y\n"
|
||||
" [2] => 3\n"
|
||||
" )\n"
|
||||
"\n"
|
||||
")\n");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_var_export() {
|
||||
{
|
||||
Variant v = CREATE_MAP3("a","apple","b",2,"c",CREATE_VECTOR3(1,"y",3));
|
||||
VS(f_var_export(v, true),
|
||||
"array (\n"
|
||||
" 'a' => 'apple',\n"
|
||||
" 'b' => 2,\n"
|
||||
" 'c' => \n"
|
||||
" array (\n"
|
||||
" 0 => 1,\n"
|
||||
" 1 => 'y',\n"
|
||||
" 2 => 3,\n"
|
||||
" ),\n"
|
||||
")");
|
||||
}
|
||||
{
|
||||
String current_locale = f_setlocale(2, k_LC_ALL, "0");
|
||||
if (f_setlocale(2, k_LC_ALL, CREATE_VECTOR5("de","de_DE","de_DE.ISO8859-1","de_DE.ISO_8859-1","de_DE.UTF-8"))) {
|
||||
Variant v = CREATE_MAP3("a", -1, "b", 10.5, "c", 5.6);
|
||||
VS(f_var_export(v, true),
|
||||
"array (\n"
|
||||
" 'a' => -1,\n"
|
||||
" 'b' => 10.5,\n"
|
||||
" 'c' => 5.6,\n"
|
||||
")");
|
||||
f_setlocale(2, k_LC_ALL, current_locale);
|
||||
} else {
|
||||
SKIP("setlocale() failed");
|
||||
}
|
||||
}
|
||||
{
|
||||
const char cs[] = "'\0\\";
|
||||
const char cr[] = "'\\'' . \"\\0\" . '\\\\'";
|
||||
String s(cs, sizeof(cs) - 1, CopyString);
|
||||
String r(cr, sizeof(cr) - 1, CopyString);
|
||||
VS(f_var_export(s, true), cr);
|
||||
}
|
||||
{
|
||||
Variant v = CREATE_MAP3(String("\0", 1, AttachLiteral),"null","","empty","0", "nul");
|
||||
VS(f_var_export(v, true),
|
||||
"array (\n"
|
||||
" '' . \"\\0\" . '' => 'null',\n"
|
||||
" '' => 'empty',\n"
|
||||
" 0 => 'nul',\n"
|
||||
")");
|
||||
}
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_var_dump() {
|
||||
Variant v = CREATE_MAP3("a","apple","b",2,"c",CREATE_VECTOR3(1,"y",3));
|
||||
g_context->obStart();
|
||||
f_var_dump(v);
|
||||
String output = g_context->obCopyContents();
|
||||
g_context->obEnd();
|
||||
VS(output,
|
||||
"array(3) {\n"
|
||||
" [\"a\"]=>\n"
|
||||
" string(5) \"apple\"\n"
|
||||
" [\"b\"]=>\n"
|
||||
" int(2)\n"
|
||||
" [\"c\"]=>\n"
|
||||
" array(3) {\n"
|
||||
" [0]=>\n"
|
||||
" int(1)\n"
|
||||
" [1]=>\n"
|
||||
" string(1) \"y\"\n"
|
||||
" [2]=>\n"
|
||||
" int(3)\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_debug_zval_dump() {
|
||||
Variant v = CREATE_MAP3("a","apple","b",2,"c",CREATE_VECTOR3(1,"y",3));
|
||||
g_context->obStart();
|
||||
f_debug_zval_dump(v);
|
||||
String output = g_context->obCopyContents();
|
||||
g_context->obEnd();
|
||||
VS(output,
|
||||
"array(3) refcount(1){\n"
|
||||
" [\"a\"]=>\n"
|
||||
" string(5) \"apple\" refcount(1)\n"
|
||||
" [\"b\"]=>\n"
|
||||
" long(2) refcount(1)\n"
|
||||
" [\"c\"]=>\n"
|
||||
" array(3) refcount(1){\n"
|
||||
" [0]=>\n"
|
||||
" long(1) refcount(1)\n"
|
||||
" [1]=>\n"
|
||||
" string(1) \"y\" refcount(1)\n"
|
||||
" [2]=>\n"
|
||||
" long(3) refcount(1)\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_serialize() {
|
||||
Object obj(SystemLib::AllocStdClassObject());
|
||||
obj->o_set("name", "value");
|
||||
VS(f_serialize(obj), "O:8:\"stdClass\":1:{s:4:\"name\";s:5:\"value\";}");
|
||||
|
||||
Variant v = CREATE_MAP3("a","apple","b",2,"c",CREATE_VECTOR3(1,"y",3));
|
||||
VS(f_serialize(v),
|
||||
"a:3:{s:1:\"a\";s:5:\"apple\";s:1:\"b\";i:2;s:1:\"c\";a:3:{i:0;i:1;i:1;s:1:\"y\";i:2;i:3;}}");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_unserialize() {
|
||||
{
|
||||
// this was crashing
|
||||
unserialize_from_string(StringUtil::HexDecode("53203a20224c612072756f74612067697261207065722074757474692220204d203a20227365636f6e646f206d6520736920c3a820696e6361737472617461206461207175616c6368652070617274652122"));
|
||||
}
|
||||
{
|
||||
Variant v = unserialize_from_string("O:8:\"stdClass\":1:{s:4:\"name\";s:5:\"value\";}");
|
||||
VERIFY(v.is(KindOfObject));
|
||||
Object obj = v.toObject();
|
||||
VS(obj->o_getClassName(), "stdClass");
|
||||
VS(obj.o_get("name"), "value");
|
||||
}
|
||||
{
|
||||
Variant v = unserialize_from_string(String("O:8:\"stdClass\":1:{s:7:\"\0*\0name\";s:5:\"value\";}", 45, AttachLiteral));
|
||||
VERIFY(v.is(KindOfObject));
|
||||
Object obj = v.toObject();
|
||||
VS(obj->o_getClassName(), "stdClass");
|
||||
VS(obj.o_get("name"), uninit_null());
|
||||
}
|
||||
{
|
||||
Variant v1 = CREATE_MAP3("a","apple","b",2,"c",CREATE_VECTOR3(1,"y",3));
|
||||
Variant v2 = unserialize_from_string("a:3:{s:1:\"a\";s:5:\"apple\";s:1:\"b\";i:2;s:1:\"c\";a:3:{i:0;i:1;i:1;s:1:\"y\";i:2;i:3;}}");
|
||||
VS(v1, v2);
|
||||
}
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_get_defined_vars() {
|
||||
f_get_defined_vars();
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_import_request_variables() {
|
||||
try {
|
||||
f_import_request_variables("G");
|
||||
} catch (const NotSupportedException& e) {
|
||||
return Count(true);
|
||||
}
|
||||
return Count(false);
|
||||
}
|
||||
|
||||
bool TestExtVariable::test_extract() {
|
||||
// extract() was extensively tested in TestCodeRun.
|
||||
return Count(true);
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| HipHop for PHP |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef incl_HPHP_TEST_EXT_VARIABLE_H_
|
||||
#define incl_HPHP_TEST_EXT_VARIABLE_H_
|
||||
|
||||
// >>>>>> Generated by idl.php. Do NOT modify. <<<<<<
|
||||
|
||||
#include "hphp/test/ext/test_cpp_ext.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TestExtVariable : public TestCppExt {
|
||||
public:
|
||||
virtual bool RunTests(const std::string &which);
|
||||
|
||||
bool test_is_bool();
|
||||
bool test_is_int();
|
||||
bool test_is_integer();
|
||||
bool test_is_long();
|
||||
bool test_is_double();
|
||||
bool test_is_float();
|
||||
bool test_is_numeric();
|
||||
bool test_is_real();
|
||||
bool test_is_string();
|
||||
bool test_is_scalar();
|
||||
bool test_is_array();
|
||||
bool test_is_object();
|
||||
bool test_is_resource();
|
||||
bool test_is_null();
|
||||
bool test_gettype();
|
||||
bool test_get_resource_type();
|
||||
bool test_intval();
|
||||
bool test_doubleval();
|
||||
bool test_floatval();
|
||||
bool test_strval();
|
||||
bool test_settype();
|
||||
bool test_print_r();
|
||||
bool test_var_export();
|
||||
bool test_var_dump();
|
||||
bool test_debug_zval_dump();
|
||||
bool test_serialize();
|
||||
bool test_unserialize();
|
||||
bool test_get_defined_vars();
|
||||
bool test_import_request_variables();
|
||||
bool test_extract();
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // incl_HPHP_TEST_EXT_VARIABLE_H_
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
function VS($x, $y) {
|
||||
var_dump($x === $y);
|
||||
if ($x !== $y) { echo "Failed: $y\n"; echo "Got: $x\n";
|
||||
var_dump(debug_backtrace()); }
|
||||
}
|
||||
function VERIFY($x) { VS($x != false, true); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
VERIFY(is_bool(true));
|
||||
VERIFY(!is_bool("test"));
|
||||
|
||||
VERIFY(is_int(123));
|
||||
VERIFY(!is_int("123"));
|
||||
|
||||
VERIFY(is_integer(123));
|
||||
VERIFY(!is_integer("123"));
|
||||
|
||||
VERIFY(is_long(123));
|
||||
VERIFY(!is_long("123"));
|
||||
|
||||
VERIFY(is_double(123.4));
|
||||
VERIFY(!is_double("123.4"));
|
||||
|
||||
VERIFY(is_float(123.4));
|
||||
VERIFY(!is_float("123.4"));
|
||||
|
||||
VERIFY(is_numeric(123));
|
||||
VERIFY(is_numeric("123.4"));
|
||||
VERIFY(!is_numeric("e123.4"));
|
||||
|
||||
VERIFY(is_real(123.4));
|
||||
VERIFY(!is_real("123.4"));
|
||||
|
||||
VERIFY(!is_string(123));
|
||||
VERIFY(is_string("test"));
|
||||
|
||||
VERIFY(is_scalar(123));
|
||||
VERIFY(is_scalar("test"));
|
||||
VERIFY(!is_scalar(null));
|
||||
VERIFY(!is_scalar(array(123)));
|
||||
|
||||
VERIFY(!is_array(123));
|
||||
VERIFY(!is_array("test"));
|
||||
VERIFY(is_array(array(123)));
|
||||
|
||||
VERIFY(!is_object(123));
|
||||
VERIFY(!is_object("test"));
|
||||
VERIFY(is_object(new stdclass));
|
||||
|
||||
VERIFY(!is_null(0));
|
||||
VERIFY(!is_null(""));
|
||||
|
||||
VS(gettype(null), "NULL");
|
||||
VS(gettype(0), "integer");
|
||||
VS(gettype("test"), "string");
|
||||
VS(gettype("hi"), "string");
|
||||
VS(gettype(array()), "array");
|
||||
VS(gettype(new stdclass), "object");
|
||||
|
||||
VS(intval("12"), 12);
|
||||
VS(intval("12", 8), 10);
|
||||
|
||||
VS(doubleval("12.3"), 12.3);
|
||||
|
||||
VS(floatval("12.3"), 12.3);
|
||||
|
||||
VS(strval(123), "123");
|
||||
|
||||
{
|
||||
$v = "5bar";
|
||||
VERIFY(settype($v, "integer"));
|
||||
VS($v, 5);
|
||||
}
|
||||
{
|
||||
$v = true;
|
||||
VERIFY(settype($v, "string"));
|
||||
VS($v, "1");
|
||||
}
|
||||
|
||||
$obj = new stdclass;
|
||||
$obj->name = "value";
|
||||
VS(serialize($obj), "O:8:\"stdClass\":1:{s:4:\"name\";s:5:\"value\";}");
|
||||
|
||||
$v = array("a"=>"apple","b"=>2,"c"=>array(1,"y",3));
|
||||
VS(serialize($v),
|
||||
"a:3:{s:1:\"a\";s:5:\"apple\";s:1:\"b\";i:2;s:1:\"c\";a:3:{i:0;i:1;i:1;s:1:\"y\";i:2;i:3;}}");
|
||||
|
||||
{
|
||||
$v = unserialize("O:8:\"stdClass\":1:{s:4:\"name\";s:5:\"value\";}");
|
||||
VERIFY(is_object($v));
|
||||
VS($v->name, "value");
|
||||
}
|
||||
{
|
||||
$v = unserialize("O:8:\"stdClass\":1:{s:7:\"\0*\0name\";s:5:\"value\";}");
|
||||
VERIFY(is_object($v));
|
||||
VS($v->name, null);
|
||||
}
|
||||
{
|
||||
$v1 = array("a" => "apple", "b" => 2,"c" => array(1,"y",3));
|
||||
$v2 = unserialize("a:3:{s:1:\"a\";s:5:\"apple\";s:1:\"b\";i:2;s:1:\"c\";a:3:{i:0;i:1;i:1;s:1:\"y\";i:2;i:3;}}");
|
||||
VS($v1, $v2);
|
||||
}
|
||||
|
||||
get_defined_vars();
|
||||
@@ -0,0 +1,53 @@
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
Referência em uma Nova Issue
Bloquear um usuário