2 Commits
0.2.3 ... 0.2.4

Author SHA1 Message Date
michael
f6251794c5 Make expect stream non-seekable (avoid warnings)
git-svn-id: https://svn.php.net/repository/pecl/expect/trunk@244508 c90b9560-bf6c-de11-be94-00142212c4b1
2007-10-20 07:15:40 +00:00
michael
2246eef8d7 Fixed #12268 (Capturing output via exp_loguser from within PHP / Apache):
git-svn-id: https://svn.php.net/repository/pecl/expect/trunk@244507 c90b9560-bf6c-de11-be94-00142212c4b1
2007-10-20 06:50:37 +00:00
2 changed files with 19 additions and 9 deletions

View File

@@ -19,6 +19,8 @@
/* $ Id: $ */
#include "php_expect.h"
#include <string.h>
#include <errno.h>
/* {{{ expect_functions[] */
function_entry expect_functions[] = {
@@ -80,11 +82,19 @@ static PHP_INI_MH(OnSetExpectLogUser)
static PHP_INI_MH(OnSetExpectLogFile)
{
if (new_value_length > 0) {
exp_logfile = fopen (new_value, "a");
if (!exp_logfile) {
php_error_docref (NULL TSRMLS_CC, E_ERROR, "could not open log file for writting");
php_stream *stream = php_stream_open_wrapper (new_value, "a", 0, NULL);
if (!stream) {
php_error_docref (NULL TSRMLS_CC, E_ERROR, "could not open log file for writing");
return FAILURE;
}
stream->flags |= PHP_STREAM_FLAG_NO_SEEK;
if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void **) &exp_logfile, REPORT_ERRORS) != SUCCESS) {
return FAILURE;
}
exp_logfile_all = 1;
} else {
exp_logfile = NULL;
exp_logfile_all = 0;
}
return SUCCESS;
}
@@ -164,6 +174,7 @@ PHP_FUNCTION(expect_popen)
if (!stream) {
RETURN_FALSE;
}
stream->flags |= PHP_STREAM_FLAG_NO_SEEK;
php_stream_to_zval(stream, return_value);
}
/* }}} */
@@ -187,9 +198,8 @@ PHP_FUNCTION(expect_expectl)
}
php_stream_from_zval (stream, &z_stream);
if (php_stream_cast (stream, PHP_STREAM_AS_FD, (void*)&fd, 1) != SUCCESS || fd < 0) {
php_error_docref (NULL TSRMLS_CC, E_ERROR, "couldn't cast expect stream to a file descriptor");
return;
if (php_stream_cast (stream, PHP_STREAM_AS_FD, (void*)&fd, REPORT_ERRORS) != SUCCESS || fd < 0) {
return;
}
argc = zend_hash_num_elements (Z_ARRVAL_P(z_cases));

View File

@@ -14,10 +14,10 @@
</maintainers>
<release>
<version>0.2.2</version>
<date>2006-07-05</date>
<version>0.2.4</version>
<date>2007-10-20</date>
<state>beta</state>
<notes>Fix segfault on scenario with EXP_TIMEOUT.
<notes>Fixed #12268 (Capturing output via exp_loguser from within PHP / Apache)
</notes>
</release>