summaryrefslogtreecommitdiff
path: root/zend/file.cpp
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-01-12 18:40:12 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-01-12 18:40:12 +0100
commita3007b9915a0ca3eec024b714cecc609e6356e17 (patch)
treee643f7ae433dbf12e6e1828950d694b855e4ec0a /zend/file.cpp
parent74388e2735e806837cd31052c513451ec3942c0a (diff)
fixed compiling in ZTS environments (reported in issue #57)
Diffstat (limited to 'zend/file.cpp')
-rw-r--r--zend/file.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/zend/file.cpp b/zend/file.cpp
index 43c2d7a..2b7e77f 100644
--- a/zend/file.cpp
+++ b/zend/file.cpp
@@ -69,6 +69,9 @@ bool File::compile()
// we are going to open the file
zend_file_handle fileHandle;
+ // we need the tsrm_ls variable (@todo would it be better if this was a member?)
+ TSRMLS_FETCH();
+
// open the file
if (zend_stream_open(_path, &fileHandle TSRMLS_CC) == FAILURE) return false;
@@ -76,13 +79,10 @@ bool File::compile()
if (!fileHandle.opened_path) fileHandle.opened_path = estrdup(_path);
// we need temporary compiler options
- CompilerOptions options(ZEND_COMPILE_DEFAULT);
+ CompilerOptions options(ZEND_COMPILE_DEFAULT TSRMLS_CC);
- // we need the tsrm_ls variable
- TSRMLS_FETCH();
-
// create the opcodes
- _opcodes = new Opcodes(zend_compile_file(&fileHandle, ZEND_INCLUDE TSRMLS_CC));
+ _opcodes = new Opcodes(zend_compile_file(&fileHandle, ZEND_INCLUDE TSRMLS_CC) TSRMLS_CC);
// close the file handle
zend_destroy_file_handle(&fileHandle TSRMLS_CC);
@@ -130,6 +130,9 @@ Value File::execute()
// try compiling the file
if (!compile()) return nullptr;
+ // we need the tsrm_ls variable (@todo would it be better if this was a member?)
+ TSRMLS_FETCH();
+
// add the entry to the list of included files
zend_hash_add_empty_element(&EG(included_files), _path, ::strlen(_path) + 1);
@@ -145,6 +148,9 @@ Value File::once()
{
// skip if the path is invalid
if (!_path) return nullptr;
+
+ // we need the tsrm_ls variable (@todo would it be better if this was a member?)
+ TSRMLS_FETCH();
// check if this file was already included
if (zend_hash_exists(&EG(included_files), _path, ::strlen(_path) + 1)) return nullptr;