php-general Digest 10 May 2013 09:36:06 -0000 Issue 8225
Topics (messages 321049 through 321050):
php extension about php_stream_fopen_tmpfile()
321049 by: Bleakwind
Having a problem with clone.
321050 by: Richard Quadling
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
I write a php extension.
How can I user Zend API do that?
where can I find some doc about file_handle->handle ?
ZEND_API zend_op_array *(*org_compile_file)(zend_file_handle *file_handle,
int type TSRMLS_DC);
ZEND_API zend_op_array *sead_compile_file(zend_file_handle *file_handle,
int type TSRMLS_DC)
{
php_stream *stream;
char *data_decode;
int data_decode_len;
/* ... */
/* Zend API Begin: This unsuccessful */
php_stream *tmpstream;
if ((tmpstream = php_stream_fopen_tmpfile()) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create
temporary file. Check permissions in temporary files directory.");
php_stream_close(stream);
return org_compile_file(file_handle, type TSRMLS_CC);
}
numbytes = php_stream_write(tmpstream, data_decode, data_decode_len);
if (numbytes != data_decode_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes
written, possibly out of free disk space", numbytes, data_decode_len);
numbytes = -1;
}
php_stream_rewind(tmpstream);
/* Zend API End */
/* C Begin: This is OK */
FILE *tmpstream;
tmpstream = tmpfile();
fwrite(data_decode, data_decode_len, 1, tmpstream);
rewind(tmpstream);
/* C End */
file_handle->handle.fp = tmpstream;
file_handle->type = ZEND_HANDLE_FP;
file_handle->opened_path = expand_filepath(file_handle->filename, NULL
TSRMLS_CC);
return org_compile_file(file_handle, type TSRMLS_CC);
}
--- End Message ---
--- Begin Message ---
Hi.
I'm having an issue where I get ...
Fatal error: Trying to clone an uncloneable object of class Smarty_Variable
in
xxxxxx/trunk.newbuild/includes/frontend/site_includes/classes/smarty-3.10/sysplugins/smarty_internal_template.php
on line 269
This issue happens consistently on our live server and on our test server,
but not on my dev setup.
The issue doesn't happen if I comment out 1 line of completely unrelated
code ...
$o_Gender = new Gender\Gender;
If I immediately follow that with ...
unset($o_Gender);
and have no other access to $o_Gender, I still get the error.
Comment out the code, no problems.
The extension is used in other parts of the system with seemingly no
problem. That is, the code behaves as expected and I get no errors, but
those elements don't use Smarty. The error being reported is clearly wrong.
And the extension (as far as I can see) has no interaction with global
elements in any way (I have to use the Gender namespace to access anything
in it - which I think is correct). I've var_dump()'d a debug_backtrace() at
the point of failure in the Smarty code, with and without the $o_Gender
variable being defined (it isn't used in the Smarty template - so Smarty is
never touching it). When I compare the 2 dumps, the only differences is in
the datetime stamp elements and the object count values (there's 1 more
when $o_Gender exists).
My setup is on a CentOS VM running PHP V5.4.14
The live setup is on a remote CentOS server running PHP V5.3.21
The test server is on CentOS server running PHP V5.3.3
I don't know CentOS well enough to just swap out a new version of PHP. But
I will be getting some help on that.
Where do I start to find the problem?
I have full root access to the command line test server, so I can, within
reason, follow instructions to run/wrap the code in any way needed.
Any help would be GREATLY appreciated!!!
Thanks in advance,
Richard.
--
Richard Quadling
Twitter : @RQuadling
--- End Message ---