d55c44a8ca
Our ext_hhvm generated code is casting TypedValue* to Value* on the assumption that the offset of TypedValue::m_data is 0. Fix this assumption, and also while in the same code, replace some (t == KindOfString || t == KindOfStaticString) with IS_STATIC_STRING(t), which does a single bit test instead of two comparisons.
945 linhas
32 KiB
C++
945 linhas
32 KiB
C++
/*
|
|
+----------------------------------------------------------------------+
|
|
| HipHop for PHP |
|
|
+----------------------------------------------------------------------+
|
|
| Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
|
|
| Copyright (c) 1997-2010 The PHP Group |
|
|
+----------------------------------------------------------------------+
|
|
| 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 <runtime/ext_hhvm/ext_hhvm.h>
|
|
#include <runtime/base/builtin_functions.h>
|
|
#include <runtime/base/array/array_init.h>
|
|
#include <runtime/ext/ext.h>
|
|
#include <runtime/vm/class.h>
|
|
#include <runtime/vm/runtime.h>
|
|
#include <exception>
|
|
|
|
namespace HPHP {
|
|
|
|
/*
|
|
HPHP::Variant HPHP::f_preg_grep(HPHP::String const&, HPHP::Array const&, int)
|
|
_ZN4HPHP11f_preg_grepERKNS_6StringERKNS_5ArrayEi
|
|
|
|
(return value) => rax
|
|
_rv => rdi
|
|
pattern => rsi
|
|
input => rdx
|
|
flags => rcx
|
|
*/
|
|
|
|
TypedValue* fh_preg_grep(TypedValue* _rv, Value* pattern, Value* input, int flags) asm("_ZN4HPHP11f_preg_grepERKNS_6StringERKNS_5ArrayEi");
|
|
|
|
TypedValue * fg1_preg_grep(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
|
|
TypedValue * fg1_preg_grep(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
switch (count) {
|
|
default: // count >= 3
|
|
if ((args-2)->m_type != KindOfInt64) {
|
|
tvCastToInt64InPlace(args-2);
|
|
}
|
|
case 2:
|
|
break;
|
|
}
|
|
if ((args-1)->m_type != KindOfArray) {
|
|
tvCastToArrayInPlace(args-1);
|
|
}
|
|
if (!IS_STRING_TYPE((args-0)->m_type)) {
|
|
tvCastToStringInPlace(args-0);
|
|
}
|
|
fh_preg_grep((rv), &args[-0].m_data, &args[-1].m_data, (count > 2) ? (int)(args[-2].m_data.num) : (int)(0));
|
|
if (rv->m_type == KindOfUninit) rv->m_type = KindOfNull;
|
|
return rv;
|
|
}
|
|
|
|
TypedValue* fg_preg_grep(HPHP::VM::ActRec *ar) {
|
|
TypedValue rv;
|
|
int64_t count = ar->numArgs();
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
if (count >= 2LL && count <= 3LL) {
|
|
if ((count <= 2 || (args-2)->m_type == KindOfInt64) && (args-1)->m_type == KindOfArray && IS_STRING_TYPE((args-0)->m_type)) {
|
|
fh_preg_grep((&(rv)), &args[-0].m_data, &args[-1].m_data, (count > 2) ? (int)(args[-2].m_data.num) : (int)(0));
|
|
if (rv.m_type == KindOfUninit) rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
} else {
|
|
fg1_preg_grep(&rv, ar, count);
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
}
|
|
} else {
|
|
throw_wrong_arguments_nr("preg_grep", count, 2, 3, 1);
|
|
}
|
|
rv.m_data.num = 0LL;
|
|
rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
return &ar->m_r;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
HPHP::Variant HPHP::f_preg_match(HPHP::String const&, HPHP::String const&, HPHP::VRefParamValue const&, int, int)
|
|
_ZN4HPHP12f_preg_matchERKNS_6StringES2_RKNS_14VRefParamValueEii
|
|
|
|
(return value) => rax
|
|
_rv => rdi
|
|
pattern => rsi
|
|
subject => rdx
|
|
matches => rcx
|
|
flags => r8
|
|
offset => r9
|
|
*/
|
|
|
|
TypedValue* fh_preg_match(TypedValue* _rv, Value* pattern, Value* subject, TypedValue* matches, int flags, int offset) asm("_ZN4HPHP12f_preg_matchERKNS_6StringES2_RKNS_14VRefParamValueEii");
|
|
|
|
TypedValue * fg1_preg_match(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
|
|
TypedValue * fg1_preg_match(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
switch (count) {
|
|
default: // count >= 5
|
|
if ((args-4)->m_type != KindOfInt64) {
|
|
tvCastToInt64InPlace(args-4);
|
|
}
|
|
case 4:
|
|
if ((args-3)->m_type != KindOfInt64) {
|
|
tvCastToInt64InPlace(args-3);
|
|
}
|
|
case 3:
|
|
case 2:
|
|
break;
|
|
}
|
|
if (!IS_STRING_TYPE((args-1)->m_type)) {
|
|
tvCastToStringInPlace(args-1);
|
|
}
|
|
if (!IS_STRING_TYPE((args-0)->m_type)) {
|
|
tvCastToStringInPlace(args-0);
|
|
}
|
|
VRefParamValue defVal2 = uninit_null();
|
|
fh_preg_match((rv), &args[-0].m_data, &args[-1].m_data, (count > 2) ? (args-2) : (TypedValue*)(&defVal2), (count > 3) ? (int)(args[-3].m_data.num) : (int)(0), (count > 4) ? (int)(args[-4].m_data.num) : (int)(0));
|
|
if (rv->m_type == KindOfUninit) rv->m_type = KindOfNull;
|
|
return rv;
|
|
}
|
|
|
|
TypedValue* fg_preg_match(HPHP::VM::ActRec *ar) {
|
|
TypedValue rv;
|
|
int64_t count = ar->numArgs();
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
if (count >= 2LL && count <= 5LL) {
|
|
if ((count <= 4 || (args-4)->m_type == KindOfInt64) && (count <= 3 || (args-3)->m_type == KindOfInt64) && IS_STRING_TYPE((args-1)->m_type) && IS_STRING_TYPE((args-0)->m_type)) {
|
|
VRefParamValue defVal2 = uninit_null();
|
|
fh_preg_match((&(rv)), &args[-0].m_data, &args[-1].m_data, (count > 2) ? (args-2) : (TypedValue*)(&defVal2), (count > 3) ? (int)(args[-3].m_data.num) : (int)(0), (count > 4) ? (int)(args[-4].m_data.num) : (int)(0));
|
|
if (rv.m_type == KindOfUninit) rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 5);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
} else {
|
|
fg1_preg_match(&rv, ar, count);
|
|
frame_free_locals_no_this_inl(ar, 5);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
}
|
|
} else {
|
|
throw_wrong_arguments_nr("preg_match", count, 2, 5, 1);
|
|
}
|
|
rv.m_data.num = 0LL;
|
|
rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 5);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
return &ar->m_r;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
HPHP::Variant HPHP::f_preg_match_all(HPHP::String const&, HPHP::String const&, HPHP::VRefParamValue const&, int, int)
|
|
_ZN4HPHP16f_preg_match_allERKNS_6StringES2_RKNS_14VRefParamValueEii
|
|
|
|
(return value) => rax
|
|
_rv => rdi
|
|
pattern => rsi
|
|
subject => rdx
|
|
matches => rcx
|
|
flags => r8
|
|
offset => r9
|
|
*/
|
|
|
|
TypedValue* fh_preg_match_all(TypedValue* _rv, Value* pattern, Value* subject, TypedValue* matches, int flags, int offset) asm("_ZN4HPHP16f_preg_match_allERKNS_6StringES2_RKNS_14VRefParamValueEii");
|
|
|
|
TypedValue * fg1_preg_match_all(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
|
|
TypedValue * fg1_preg_match_all(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
switch (count) {
|
|
default: // count >= 5
|
|
if ((args-4)->m_type != KindOfInt64) {
|
|
tvCastToInt64InPlace(args-4);
|
|
}
|
|
case 4:
|
|
if ((args-3)->m_type != KindOfInt64) {
|
|
tvCastToInt64InPlace(args-3);
|
|
}
|
|
case 3:
|
|
break;
|
|
}
|
|
if (!IS_STRING_TYPE((args-1)->m_type)) {
|
|
tvCastToStringInPlace(args-1);
|
|
}
|
|
if (!IS_STRING_TYPE((args-0)->m_type)) {
|
|
tvCastToStringInPlace(args-0);
|
|
}
|
|
fh_preg_match_all((rv), &args[-0].m_data, &args[-1].m_data, (args-2), (count > 3) ? (int)(args[-3].m_data.num) : (int)(0), (count > 4) ? (int)(args[-4].m_data.num) : (int)(0));
|
|
if (rv->m_type == KindOfUninit) rv->m_type = KindOfNull;
|
|
return rv;
|
|
}
|
|
|
|
TypedValue* fg_preg_match_all(HPHP::VM::ActRec *ar) {
|
|
TypedValue rv;
|
|
int64_t count = ar->numArgs();
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
if (count >= 3LL && count <= 5LL) {
|
|
if ((count <= 4 || (args-4)->m_type == KindOfInt64) && (count <= 3 || (args-3)->m_type == KindOfInt64) && IS_STRING_TYPE((args-1)->m_type) && IS_STRING_TYPE((args-0)->m_type)) {
|
|
fh_preg_match_all((&(rv)), &args[-0].m_data, &args[-1].m_data, (args-2), (count > 3) ? (int)(args[-3].m_data.num) : (int)(0), (count > 4) ? (int)(args[-4].m_data.num) : (int)(0));
|
|
if (rv.m_type == KindOfUninit) rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 5);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
} else {
|
|
fg1_preg_match_all(&rv, ar, count);
|
|
frame_free_locals_no_this_inl(ar, 5);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
}
|
|
} else {
|
|
throw_wrong_arguments_nr("preg_match_all", count, 3, 5, 1);
|
|
}
|
|
rv.m_data.num = 0LL;
|
|
rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 5);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
return &ar->m_r;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
HPHP::Variant HPHP::f_preg_replace(HPHP::Variant const&, HPHP::Variant const&, HPHP::Variant const&, int, HPHP::VRefParamValue const&)
|
|
_ZN4HPHP14f_preg_replaceERKNS_7VariantES2_S2_iRKNS_14VRefParamValueE
|
|
|
|
(return value) => rax
|
|
_rv => rdi
|
|
pattern => rsi
|
|
replacement => rdx
|
|
subject => rcx
|
|
limit => r8
|
|
count => r9
|
|
*/
|
|
|
|
TypedValue* fh_preg_replace(TypedValue* _rv, TypedValue* pattern, TypedValue* replacement, TypedValue* subject, int limit, TypedValue* count) asm("_ZN4HPHP14f_preg_replaceERKNS_7VariantES2_S2_iRKNS_14VRefParamValueE");
|
|
|
|
TypedValue * fg1_preg_replace(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
|
|
TypedValue * fg1_preg_replace(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
tvCastToInt64InPlace(args-3);
|
|
VRefParamValue defVal4 = uninit_null();
|
|
fh_preg_replace((rv), (args-0), (args-1), (args-2), (count > 3) ? (int)(args[-3].m_data.num) : (int)(-1), (count > 4) ? (args-4) : (TypedValue*)(&defVal4));
|
|
if (rv->m_type == KindOfUninit) rv->m_type = KindOfNull;
|
|
return rv;
|
|
}
|
|
|
|
TypedValue* fg_preg_replace(HPHP::VM::ActRec *ar) {
|
|
TypedValue rv;
|
|
int64_t count = ar->numArgs();
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
if (count >= 3LL && count <= 5LL) {
|
|
if ((count <= 3 || (args-3)->m_type == KindOfInt64)) {
|
|
VRefParamValue defVal4 = uninit_null();
|
|
fh_preg_replace((&(rv)), (args-0), (args-1), (args-2), (count > 3) ? (int)(args[-3].m_data.num) : (int)(-1), (count > 4) ? (args-4) : (TypedValue*)(&defVal4));
|
|
if (rv.m_type == KindOfUninit) rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 5);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
} else {
|
|
fg1_preg_replace(&rv, ar, count);
|
|
frame_free_locals_no_this_inl(ar, 5);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
}
|
|
} else {
|
|
throw_wrong_arguments_nr("preg_replace", count, 3, 5, 1);
|
|
}
|
|
rv.m_data.num = 0LL;
|
|
rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 5);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
return &ar->m_r;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
HPHP::Variant HPHP::f_preg_replace_callback(HPHP::Variant const&, HPHP::Variant const&, HPHP::Variant const&, int, HPHP::VRefParamValue const&)
|
|
_ZN4HPHP23f_preg_replace_callbackERKNS_7VariantES2_S2_iRKNS_14VRefParamValueE
|
|
|
|
(return value) => rax
|
|
_rv => rdi
|
|
pattern => rsi
|
|
callback => rdx
|
|
subject => rcx
|
|
limit => r8
|
|
count => r9
|
|
*/
|
|
|
|
TypedValue* fh_preg_replace_callback(TypedValue* _rv, TypedValue* pattern, TypedValue* callback, TypedValue* subject, int limit, TypedValue* count) asm("_ZN4HPHP23f_preg_replace_callbackERKNS_7VariantES2_S2_iRKNS_14VRefParamValueE");
|
|
|
|
TypedValue * fg1_preg_replace_callback(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
|
|
TypedValue * fg1_preg_replace_callback(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
tvCastToInt64InPlace(args-3);
|
|
VRefParamValue defVal4 = uninit_null();
|
|
fh_preg_replace_callback((rv), (args-0), (args-1), (args-2), (count > 3) ? (int)(args[-3].m_data.num) : (int)(-1), (count > 4) ? (args-4) : (TypedValue*)(&defVal4));
|
|
if (rv->m_type == KindOfUninit) rv->m_type = KindOfNull;
|
|
return rv;
|
|
}
|
|
|
|
TypedValue* fg_preg_replace_callback(HPHP::VM::ActRec *ar) {
|
|
TypedValue rv;
|
|
int64_t count = ar->numArgs();
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
if (count >= 3LL && count <= 5LL) {
|
|
if ((count <= 3 || (args-3)->m_type == KindOfInt64)) {
|
|
VRefParamValue defVal4 = uninit_null();
|
|
fh_preg_replace_callback((&(rv)), (args-0), (args-1), (args-2), (count > 3) ? (int)(args[-3].m_data.num) : (int)(-1), (count > 4) ? (args-4) : (TypedValue*)(&defVal4));
|
|
if (rv.m_type == KindOfUninit) rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 5);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
} else {
|
|
fg1_preg_replace_callback(&rv, ar, count);
|
|
frame_free_locals_no_this_inl(ar, 5);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
}
|
|
} else {
|
|
throw_wrong_arguments_nr("preg_replace_callback", count, 3, 5, 1);
|
|
}
|
|
rv.m_data.num = 0LL;
|
|
rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 5);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
return &ar->m_r;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
HPHP::Variant HPHP::f_preg_split(HPHP::Variant const&, HPHP::Variant const&, int, int)
|
|
_ZN4HPHP12f_preg_splitERKNS_7VariantES2_ii
|
|
|
|
(return value) => rax
|
|
_rv => rdi
|
|
pattern => rsi
|
|
subject => rdx
|
|
limit => rcx
|
|
flags => r8
|
|
*/
|
|
|
|
TypedValue* fh_preg_split(TypedValue* _rv, TypedValue* pattern, TypedValue* subject, int limit, int flags) asm("_ZN4HPHP12f_preg_splitERKNS_7VariantES2_ii");
|
|
|
|
TypedValue * fg1_preg_split(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
|
|
TypedValue * fg1_preg_split(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
switch (count) {
|
|
default: // count >= 4
|
|
if ((args-3)->m_type != KindOfInt64) {
|
|
tvCastToInt64InPlace(args-3);
|
|
}
|
|
case 3:
|
|
if ((args-2)->m_type != KindOfInt64) {
|
|
tvCastToInt64InPlace(args-2);
|
|
}
|
|
case 2:
|
|
break;
|
|
}
|
|
fh_preg_split((rv), (args-0), (args-1), (count > 2) ? (int)(args[-2].m_data.num) : (int)(-1), (count > 3) ? (int)(args[-3].m_data.num) : (int)(0));
|
|
if (rv->m_type == KindOfUninit) rv->m_type = KindOfNull;
|
|
return rv;
|
|
}
|
|
|
|
TypedValue* fg_preg_split(HPHP::VM::ActRec *ar) {
|
|
TypedValue rv;
|
|
int64_t count = ar->numArgs();
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
if (count >= 2LL && count <= 4LL) {
|
|
if ((count <= 3 || (args-3)->m_type == KindOfInt64) && (count <= 2 || (args-2)->m_type == KindOfInt64)) {
|
|
fh_preg_split((&(rv)), (args-0), (args-1), (count > 2) ? (int)(args[-2].m_data.num) : (int)(-1), (count > 3) ? (int)(args[-3].m_data.num) : (int)(0));
|
|
if (rv.m_type == KindOfUninit) rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 4);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
} else {
|
|
fg1_preg_split(&rv, ar, count);
|
|
frame_free_locals_no_this_inl(ar, 4);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
}
|
|
} else {
|
|
throw_wrong_arguments_nr("preg_split", count, 2, 4, 1);
|
|
}
|
|
rv.m_data.num = 0LL;
|
|
rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 4);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
return &ar->m_r;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
HPHP::String HPHP::f_preg_quote(HPHP::String const&, HPHP::String const&)
|
|
_ZN4HPHP12f_preg_quoteERKNS_6StringES2_
|
|
|
|
(return value) => rax
|
|
_rv => rdi
|
|
str => rsi
|
|
delimiter => rdx
|
|
*/
|
|
|
|
Value* fh_preg_quote(Value* _rv, Value* str, Value* delimiter) asm("_ZN4HPHP12f_preg_quoteERKNS_6StringES2_");
|
|
|
|
TypedValue * fg1_preg_quote(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
|
|
TypedValue * fg1_preg_quote(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
rv->m_type = KindOfString;
|
|
switch (count) {
|
|
default: // count >= 2
|
|
if (!IS_STRING_TYPE((args-1)->m_type)) {
|
|
tvCastToStringInPlace(args-1);
|
|
}
|
|
case 1:
|
|
break;
|
|
}
|
|
if (!IS_STRING_TYPE((args-0)->m_type)) {
|
|
tvCastToStringInPlace(args-0);
|
|
}
|
|
fh_preg_quote((&rv->m_data), &args[-0].m_data, (count > 1) ? &args[-1].m_data : (Value*)(&null_string));
|
|
if (rv->m_data.num == 0LL) rv->m_type = KindOfNull;
|
|
return rv;
|
|
}
|
|
|
|
TypedValue* fg_preg_quote(HPHP::VM::ActRec *ar) {
|
|
TypedValue rv;
|
|
int64_t count = ar->numArgs();
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
if (count >= 1LL && count <= 2LL) {
|
|
if ((count <= 1 || IS_STRING_TYPE((args-1)->m_type)) && IS_STRING_TYPE((args-0)->m_type)) {
|
|
rv.m_type = KindOfString;
|
|
fh_preg_quote((&rv.m_data), &args[-0].m_data, (count > 1) ? &args[-1].m_data : (Value*)(&null_string));
|
|
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 2);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
} else {
|
|
fg1_preg_quote(&rv, ar, count);
|
|
frame_free_locals_no_this_inl(ar, 2);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
}
|
|
} else {
|
|
throw_wrong_arguments_nr("preg_quote", count, 1, 2, 1);
|
|
}
|
|
rv.m_data.num = 0LL;
|
|
rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 2);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
return &ar->m_r;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
long HPHP::f_preg_last_error()
|
|
_ZN4HPHP17f_preg_last_errorEv
|
|
|
|
(return value) => rax
|
|
*/
|
|
|
|
long fh_preg_last_error() asm("_ZN4HPHP17f_preg_last_errorEv");
|
|
|
|
TypedValue* fg_preg_last_error(HPHP::VM::ActRec *ar) {
|
|
TypedValue rv;
|
|
int64_t count = ar->numArgs();
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
if (count == 0LL) {
|
|
rv.m_type = KindOfInt64;
|
|
rv.m_data.num = (int64_t)fh_preg_last_error();
|
|
frame_free_locals_no_this_inl(ar, 0);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
} else {
|
|
throw_toomany_arguments_nr("preg_last_error", 0, 1);
|
|
}
|
|
rv.m_data.num = 0LL;
|
|
rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 0);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
return &ar->m_r;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
HPHP::String HPHP::f_ereg_replace(HPHP::String const&, HPHP::String const&, HPHP::String const&)
|
|
_ZN4HPHP14f_ereg_replaceERKNS_6StringES2_S2_
|
|
|
|
(return value) => rax
|
|
_rv => rdi
|
|
pattern => rsi
|
|
replacement => rdx
|
|
str => rcx
|
|
*/
|
|
|
|
Value* fh_ereg_replace(Value* _rv, Value* pattern, Value* replacement, Value* str) asm("_ZN4HPHP14f_ereg_replaceERKNS_6StringES2_S2_");
|
|
|
|
TypedValue * fg1_ereg_replace(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
|
|
TypedValue * fg1_ereg_replace(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
rv->m_type = KindOfString;
|
|
if (!IS_STRING_TYPE((args-2)->m_type)) {
|
|
tvCastToStringInPlace(args-2);
|
|
}
|
|
if (!IS_STRING_TYPE((args-1)->m_type)) {
|
|
tvCastToStringInPlace(args-1);
|
|
}
|
|
if (!IS_STRING_TYPE((args-0)->m_type)) {
|
|
tvCastToStringInPlace(args-0);
|
|
}
|
|
fh_ereg_replace((&rv->m_data), &args[-0].m_data, &args[-1].m_data, &args[-2].m_data);
|
|
if (rv->m_data.num == 0LL) rv->m_type = KindOfNull;
|
|
return rv;
|
|
}
|
|
|
|
TypedValue* fg_ereg_replace(HPHP::VM::ActRec *ar) {
|
|
TypedValue rv;
|
|
int64_t count = ar->numArgs();
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
if (count == 3LL) {
|
|
if (IS_STRING_TYPE((args-2)->m_type) && IS_STRING_TYPE((args-1)->m_type) && IS_STRING_TYPE((args-0)->m_type)) {
|
|
rv.m_type = KindOfString;
|
|
fh_ereg_replace((&rv.m_data), &args[-0].m_data, &args[-1].m_data, &args[-2].m_data);
|
|
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
} else {
|
|
fg1_ereg_replace(&rv, ar, count);
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
}
|
|
} else {
|
|
throw_wrong_arguments_nr("ereg_replace", count, 3, 3, 1);
|
|
}
|
|
rv.m_data.num = 0LL;
|
|
rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
return &ar->m_r;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
HPHP::String HPHP::f_eregi_replace(HPHP::String const&, HPHP::String const&, HPHP::String const&)
|
|
_ZN4HPHP15f_eregi_replaceERKNS_6StringES2_S2_
|
|
|
|
(return value) => rax
|
|
_rv => rdi
|
|
pattern => rsi
|
|
replacement => rdx
|
|
str => rcx
|
|
*/
|
|
|
|
Value* fh_eregi_replace(Value* _rv, Value* pattern, Value* replacement, Value* str) asm("_ZN4HPHP15f_eregi_replaceERKNS_6StringES2_S2_");
|
|
|
|
TypedValue * fg1_eregi_replace(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
|
|
TypedValue * fg1_eregi_replace(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
rv->m_type = KindOfString;
|
|
if (!IS_STRING_TYPE((args-2)->m_type)) {
|
|
tvCastToStringInPlace(args-2);
|
|
}
|
|
if (!IS_STRING_TYPE((args-1)->m_type)) {
|
|
tvCastToStringInPlace(args-1);
|
|
}
|
|
if (!IS_STRING_TYPE((args-0)->m_type)) {
|
|
tvCastToStringInPlace(args-0);
|
|
}
|
|
fh_eregi_replace((&rv->m_data), &args[-0].m_data, &args[-1].m_data, &args[-2].m_data);
|
|
if (rv->m_data.num == 0LL) rv->m_type = KindOfNull;
|
|
return rv;
|
|
}
|
|
|
|
TypedValue* fg_eregi_replace(HPHP::VM::ActRec *ar) {
|
|
TypedValue rv;
|
|
int64_t count = ar->numArgs();
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
if (count == 3LL) {
|
|
if (IS_STRING_TYPE((args-2)->m_type) && IS_STRING_TYPE((args-1)->m_type) && IS_STRING_TYPE((args-0)->m_type)) {
|
|
rv.m_type = KindOfString;
|
|
fh_eregi_replace((&rv.m_data), &args[-0].m_data, &args[-1].m_data, &args[-2].m_data);
|
|
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
} else {
|
|
fg1_eregi_replace(&rv, ar, count);
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
}
|
|
} else {
|
|
throw_wrong_arguments_nr("eregi_replace", count, 3, 3, 1);
|
|
}
|
|
rv.m_data.num = 0LL;
|
|
rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
return &ar->m_r;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
HPHP::Variant HPHP::f_ereg(HPHP::String const&, HPHP::String const&, HPHP::VRefParamValue const&)
|
|
_ZN4HPHP6f_eregERKNS_6StringES2_RKNS_14VRefParamValueE
|
|
|
|
(return value) => rax
|
|
_rv => rdi
|
|
pattern => rsi
|
|
str => rdx
|
|
regs => rcx
|
|
*/
|
|
|
|
TypedValue* fh_ereg(TypedValue* _rv, Value* pattern, Value* str, TypedValue* regs) asm("_ZN4HPHP6f_eregERKNS_6StringES2_RKNS_14VRefParamValueE");
|
|
|
|
TypedValue * fg1_ereg(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
|
|
TypedValue * fg1_ereg(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
switch (count) {
|
|
default: // count >= 3
|
|
case 2:
|
|
break;
|
|
}
|
|
if (!IS_STRING_TYPE((args-1)->m_type)) {
|
|
tvCastToStringInPlace(args-1);
|
|
}
|
|
if (!IS_STRING_TYPE((args-0)->m_type)) {
|
|
tvCastToStringInPlace(args-0);
|
|
}
|
|
VRefParamValue defVal2 = uninit_null();
|
|
fh_ereg((rv), &args[-0].m_data, &args[-1].m_data, (count > 2) ? (args-2) : (TypedValue*)(&defVal2));
|
|
if (rv->m_type == KindOfUninit) rv->m_type = KindOfNull;
|
|
return rv;
|
|
}
|
|
|
|
TypedValue* fg_ereg(HPHP::VM::ActRec *ar) {
|
|
TypedValue rv;
|
|
int64_t count = ar->numArgs();
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
if (count >= 2LL && count <= 3LL) {
|
|
if (IS_STRING_TYPE((args-1)->m_type) && IS_STRING_TYPE((args-0)->m_type)) {
|
|
VRefParamValue defVal2 = uninit_null();
|
|
fh_ereg((&(rv)), &args[-0].m_data, &args[-1].m_data, (count > 2) ? (args-2) : (TypedValue*)(&defVal2));
|
|
if (rv.m_type == KindOfUninit) rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
} else {
|
|
fg1_ereg(&rv, ar, count);
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
}
|
|
} else {
|
|
throw_wrong_arguments_nr("ereg", count, 2, 3, 1);
|
|
}
|
|
rv.m_data.num = 0LL;
|
|
rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
return &ar->m_r;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
HPHP::Variant HPHP::f_eregi(HPHP::String const&, HPHP::String const&, HPHP::VRefParamValue const&)
|
|
_ZN4HPHP7f_eregiERKNS_6StringES2_RKNS_14VRefParamValueE
|
|
|
|
(return value) => rax
|
|
_rv => rdi
|
|
pattern => rsi
|
|
str => rdx
|
|
regs => rcx
|
|
*/
|
|
|
|
TypedValue* fh_eregi(TypedValue* _rv, Value* pattern, Value* str, TypedValue* regs) asm("_ZN4HPHP7f_eregiERKNS_6StringES2_RKNS_14VRefParamValueE");
|
|
|
|
TypedValue * fg1_eregi(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
|
|
TypedValue * fg1_eregi(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
switch (count) {
|
|
default: // count >= 3
|
|
case 2:
|
|
break;
|
|
}
|
|
if (!IS_STRING_TYPE((args-1)->m_type)) {
|
|
tvCastToStringInPlace(args-1);
|
|
}
|
|
if (!IS_STRING_TYPE((args-0)->m_type)) {
|
|
tvCastToStringInPlace(args-0);
|
|
}
|
|
VRefParamValue defVal2 = uninit_null();
|
|
fh_eregi((rv), &args[-0].m_data, &args[-1].m_data, (count > 2) ? (args-2) : (TypedValue*)(&defVal2));
|
|
if (rv->m_type == KindOfUninit) rv->m_type = KindOfNull;
|
|
return rv;
|
|
}
|
|
|
|
TypedValue* fg_eregi(HPHP::VM::ActRec *ar) {
|
|
TypedValue rv;
|
|
int64_t count = ar->numArgs();
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
if (count >= 2LL && count <= 3LL) {
|
|
if (IS_STRING_TYPE((args-1)->m_type) && IS_STRING_TYPE((args-0)->m_type)) {
|
|
VRefParamValue defVal2 = uninit_null();
|
|
fh_eregi((&(rv)), &args[-0].m_data, &args[-1].m_data, (count > 2) ? (args-2) : (TypedValue*)(&defVal2));
|
|
if (rv.m_type == KindOfUninit) rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
} else {
|
|
fg1_eregi(&rv, ar, count);
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
}
|
|
} else {
|
|
throw_wrong_arguments_nr("eregi", count, 2, 3, 1);
|
|
}
|
|
rv.m_data.num = 0LL;
|
|
rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
return &ar->m_r;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
HPHP::Variant HPHP::f_split(HPHP::String const&, HPHP::String const&, int)
|
|
_ZN4HPHP7f_splitERKNS_6StringES2_i
|
|
|
|
(return value) => rax
|
|
_rv => rdi
|
|
pattern => rsi
|
|
str => rdx
|
|
limit => rcx
|
|
*/
|
|
|
|
TypedValue* fh_split(TypedValue* _rv, Value* pattern, Value* str, int limit) asm("_ZN4HPHP7f_splitERKNS_6StringES2_i");
|
|
|
|
TypedValue * fg1_split(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
|
|
TypedValue * fg1_split(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
switch (count) {
|
|
default: // count >= 3
|
|
if ((args-2)->m_type != KindOfInt64) {
|
|
tvCastToInt64InPlace(args-2);
|
|
}
|
|
case 2:
|
|
break;
|
|
}
|
|
if (!IS_STRING_TYPE((args-1)->m_type)) {
|
|
tvCastToStringInPlace(args-1);
|
|
}
|
|
if (!IS_STRING_TYPE((args-0)->m_type)) {
|
|
tvCastToStringInPlace(args-0);
|
|
}
|
|
fh_split((rv), &args[-0].m_data, &args[-1].m_data, (count > 2) ? (int)(args[-2].m_data.num) : (int)(-1));
|
|
if (rv->m_type == KindOfUninit) rv->m_type = KindOfNull;
|
|
return rv;
|
|
}
|
|
|
|
TypedValue* fg_split(HPHP::VM::ActRec *ar) {
|
|
TypedValue rv;
|
|
int64_t count = ar->numArgs();
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
if (count >= 2LL && count <= 3LL) {
|
|
if ((count <= 2 || (args-2)->m_type == KindOfInt64) && IS_STRING_TYPE((args-1)->m_type) && IS_STRING_TYPE((args-0)->m_type)) {
|
|
fh_split((&(rv)), &args[-0].m_data, &args[-1].m_data, (count > 2) ? (int)(args[-2].m_data.num) : (int)(-1));
|
|
if (rv.m_type == KindOfUninit) rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
} else {
|
|
fg1_split(&rv, ar, count);
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
}
|
|
} else {
|
|
throw_wrong_arguments_nr("split", count, 2, 3, 1);
|
|
}
|
|
rv.m_data.num = 0LL;
|
|
rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
return &ar->m_r;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
HPHP::Variant HPHP::f_spliti(HPHP::String const&, HPHP::String const&, int)
|
|
_ZN4HPHP8f_splitiERKNS_6StringES2_i
|
|
|
|
(return value) => rax
|
|
_rv => rdi
|
|
pattern => rsi
|
|
str => rdx
|
|
limit => rcx
|
|
*/
|
|
|
|
TypedValue* fh_spliti(TypedValue* _rv, Value* pattern, Value* str, int limit) asm("_ZN4HPHP8f_splitiERKNS_6StringES2_i");
|
|
|
|
TypedValue * fg1_spliti(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
|
|
TypedValue * fg1_spliti(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
switch (count) {
|
|
default: // count >= 3
|
|
if ((args-2)->m_type != KindOfInt64) {
|
|
tvCastToInt64InPlace(args-2);
|
|
}
|
|
case 2:
|
|
break;
|
|
}
|
|
if (!IS_STRING_TYPE((args-1)->m_type)) {
|
|
tvCastToStringInPlace(args-1);
|
|
}
|
|
if (!IS_STRING_TYPE((args-0)->m_type)) {
|
|
tvCastToStringInPlace(args-0);
|
|
}
|
|
fh_spliti((rv), &args[-0].m_data, &args[-1].m_data, (count > 2) ? (int)(args[-2].m_data.num) : (int)(-1));
|
|
if (rv->m_type == KindOfUninit) rv->m_type = KindOfNull;
|
|
return rv;
|
|
}
|
|
|
|
TypedValue* fg_spliti(HPHP::VM::ActRec *ar) {
|
|
TypedValue rv;
|
|
int64_t count = ar->numArgs();
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
if (count >= 2LL && count <= 3LL) {
|
|
if ((count <= 2 || (args-2)->m_type == KindOfInt64) && IS_STRING_TYPE((args-1)->m_type) && IS_STRING_TYPE((args-0)->m_type)) {
|
|
fh_spliti((&(rv)), &args[-0].m_data, &args[-1].m_data, (count > 2) ? (int)(args[-2].m_data.num) : (int)(-1));
|
|
if (rv.m_type == KindOfUninit) rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
} else {
|
|
fg1_spliti(&rv, ar, count);
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
}
|
|
} else {
|
|
throw_wrong_arguments_nr("spliti", count, 2, 3, 1);
|
|
}
|
|
rv.m_data.num = 0LL;
|
|
rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 3);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
return &ar->m_r;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
HPHP::String HPHP::f_sql_regcase(HPHP::String const&)
|
|
_ZN4HPHP13f_sql_regcaseERKNS_6StringE
|
|
|
|
(return value) => rax
|
|
_rv => rdi
|
|
str => rsi
|
|
*/
|
|
|
|
Value* fh_sql_regcase(Value* _rv, Value* str) asm("_ZN4HPHP13f_sql_regcaseERKNS_6StringE");
|
|
|
|
TypedValue * fg1_sql_regcase(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
|
|
TypedValue * fg1_sql_regcase(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
rv->m_type = KindOfString;
|
|
tvCastToStringInPlace(args-0);
|
|
fh_sql_regcase((&rv->m_data), &args[-0].m_data);
|
|
if (rv->m_data.num == 0LL) rv->m_type = KindOfNull;
|
|
return rv;
|
|
}
|
|
|
|
TypedValue* fg_sql_regcase(HPHP::VM::ActRec *ar) {
|
|
TypedValue rv;
|
|
int64_t count = ar->numArgs();
|
|
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
|
|
if (count == 1LL) {
|
|
if (IS_STRING_TYPE((args-0)->m_type)) {
|
|
rv.m_type = KindOfString;
|
|
fh_sql_regcase((&rv.m_data), &args[-0].m_data);
|
|
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 1);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
} else {
|
|
fg1_sql_regcase(&rv, ar, count);
|
|
frame_free_locals_no_this_inl(ar, 1);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
}
|
|
} else {
|
|
throw_wrong_arguments_nr("sql_regcase", count, 1, 1, 1);
|
|
}
|
|
rv.m_data.num = 0LL;
|
|
rv.m_type = KindOfNull;
|
|
frame_free_locals_no_this_inl(ar, 1);
|
|
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
|
|
return &ar->m_r;
|
|
return &ar->m_r;
|
|
}
|
|
|
|
|
|
|
|
|
|
} // !HPHP
|
|
|