Skip to content

Instantly share code, notes, and snippets.

View ptarjan's full-sized avatar

Paul Tarjan ptarjan

View GitHub Profile
enum Mode {
PHP_INI_NONE = 0,
PHP_INI_ONLY = 1,
PHP_INI_SYSTEM = 2,
PHP_INI_PERDIR = 4,
PHP_INI_USER = 8,
PHP_INI_ALL = 16,
};
some_function(Mode mode) {
diff --git a/hphp/runtime/ext/ext_pdo.cpp b/hphp/runtime/ext/ext_pdo.cpp
index c49fd8f..81a4d73 100644
--- a/hphp/runtime/ext/ext_pdo.cpp
+++ b/hphp/runtime/ext/ext_pdo.cpp
@@ -2025,7 +2025,7 @@ static bool do_fetch(sp_PDOStatement stmt, bool do_bind, Variant &ret,
static int register_bound_param(CVarRef paramno, VRefParam param, int64_t type,
int64_t max_value_len, CVarRef driver_params,
sp_PDOStatement stmt, bool is_param) {
- SmartResource<PDOBoundParam> p(new PDOBoundParam);
+ SmartResource<PDOBoundParam> p(NEWOBJ(PDOBoundParam));
diff --git a/hphp/runtime/ext/ext_pdo.cpp b/hphp/runtime/ext/ext_pdo.cpp
index c49fd8f..81a4d73 100644
--- a/hphp/runtime/ext/ext_pdo.cpp
+++ b/hphp/runtime/ext/ext_pdo.cpp
@@ -2025,7 +2025,7 @@ static bool do_fetch(sp_PDOStatement stmt, bool do_bind, Variant &ret,
static int register_bound_param(CVarRef paramno, VRefParam param, int64_t type,
int64_t max_value_len, CVarRef driver_params,
sp_PDOStatement stmt, bool is_param) {
- SmartResource<PDOBoundParam> p(new PDOBoundParam);
+ SmartResource<PDOBoundParam> p(NEWOBJ(PDOBoundParam));
diff --git a/hphp/runtime/ext/ext_pdo.cpp b/hphp/runtime/ext/ext_pdo.cpp
index c49fd8f..81a4d73 100644
--- a/hphp/runtime/ext/ext_pdo.cpp
+++ b/hphp/runtime/ext/ext_pdo.cpp
@@ -2025,7 +2025,7 @@ static bool do_fetch(sp_PDOStatement stmt, bool do_bind, Variant &ret,
static int register_bound_param(CVarRef paramno, VRefParam param, int64_t type,
int64_t max_value_len, CVarRef driver_params,
sp_PDOStatement stmt, bool is_param) {
- SmartResource<PDOBoundParam> p(new PDOBoundParam);
+ SmartResource<PDOBoundParam> p(NEWOBJ(PDOBoundParam));
diff --git a/hphp/runtime/base/execution-context.cpp b/hphp/runtime/base/execution-context.cpp
index f61160c..ecf0a41 100644
--- a/hphp/runtime/base/execution-context.cpp
+++ b/hphp/runtime/base/execution-context.cpp
@@ -54,6 +54,8 @@ int64_t VMExecutionContext::s_threadIdxCounter = 0;
Mutex VMExecutionContext::s_threadIdxLock;
hphp_hash_map<pid_t, int64_t> VMExecutionContext::s_threadIdxMap;
+const StaticString s_dot(".");
+
test/slow/ext_string/ext_string.php
--- test/slow/ext_string/ext_string.php.expectf 2014-02-20 16:52:52.140332980 -0800
+++ test/slow/ext_string/ext_string.php.out 2014-02-20 16:55:00.164812815 -0800
@@ -100,20 +100,20 @@
ooooord."
string(52) "I'll &quot;walk&quot; the &lt;b&gt;dog&lt;/b&gt; now"
string(30) "I'll "walk" the <b>dog</b> now"
-string(4) "c2a0"
+string(2) "a0"
string(4) "c2a0"
--- test/slow/ext_string/ext_string.php.expectf 2014-02-20 17:06:16.508817407 -0800
+++ test/slow/ext_string/ext_string.php.out 2014-02-20 17:08:04.533109939 -0800
@@ -112,8 +112,8 @@
string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
string(46) "A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt;"
string(0) ""
-string(6) "&nbsp;"
-string(6) "&nbsp;"
+string(2) " "
+string(2) " "
static std::string ini_get_save_handler(void *p) {
- return PS(mod)->getName();
+ auto &mod = PS(mod);
+ if (!mod) {
+ return "";
+ }
+ return mod->getName();
}
From 810e4b11822df901a4a8169c0c26a6a29e1e92e5 Mon Sep 17 00:00:00 2001
From: Tim Starling <tstarling@wikimedia.org>
Date: Fri, 14 Mar 2014 09:33:52 +1100
Subject: [PATCH] EZC: Implement TSRM globals
Summary:
* Implement TSRM globals properly, i.e. have different globals for
different threads.
* Enable the ZTS macro. This is generally used by Zend extensions to
know if they need to be thread-safe, so for HHVM best answer is yes,
diff --git i/hphp/runtime/base/program-functions.cpp w/hphp/runtime/base/program-functions.cpp
index 392e1cc..ecc22a0 100644
--- i/hphp/runtime/base/program-functions.cpp
+++ w/hphp/runtime/base/program-functions.cpp
@@ -1149,6 +1149,11 @@ static int execute_program_impl(int argc, char** argv) {
Logger::Verbose("Using default config file: %s", default_config_file);
po.config.push_back(default_config_file);
}
+ auto default_config_file = "/etc/hhvm/config.hdf";
+ if (access(default_config_file, R_OK) != -1) {