7 Commits
0.2.4 ... 0.2.6

Author SHA1 Message Date
gwynne
e4b08ad2de fix a huge number of wrong MIME types. UGH.
git-svn-id: https://svn.php.net/repository/pecl/expect/trunk@284003 c90b9560-bf6c-de11-be94-00142212c4b1
2009-07-13 12:15:13 +00:00
shire
ce1a540073 fixes with arginfo for php-5.3 compatability
git-svn-id: https://svn.php.net/repository/pecl/expect/trunk@276740 c90b9560-bf6c-de11-be94-00142212c4b1
2009-03-03 23:21:38 +00:00
michael
f85ba457db add new release 0.2.5
git-svn-id: https://svn.php.net/repository/pecl/expect/trunk@269920 c90b9560-bf6c-de11-be94-00142212c4b1
2008-11-27 10:13:57 +00:00
michael
b7d18cfbb9 Fixed bug #14768 (configure error in Ubuntu 8.04)
git-svn-id: https://svn.php.net/repository/pecl/expect/trunk@269919 c90b9560-bf6c-de11-be94-00142212c4b1
2008-11-27 10:10:11 +00:00
sfox
c5895a300f - Bring the majority of PECL extensions into line with macro/x.x.x versioning.
- Please use the -dev tag during the development cycle so that snapshots can easily be distinguished from releases.


git-svn-id: https://svn.php.net/repository/pecl/expect/trunk@256435 c90b9560-bf6c-de11-be94-00142212c4b1
2008-03-31 09:37:00 +00:00
michael
925378d4ae adhere to C standard
git-svn-id: https://svn.php.net/repository/pecl/expect/trunk@244616 c90b9560-bf6c-de11-be94-00142212c4b1
2007-10-22 15:27:03 +00:00
michael
4e2f9109e1 Fixed Bug #6996 (Segmentation fault on expect_expectl)
git-svn-id: https://svn.php.net/repository/pecl/expect/trunk@244548 c90b9560-bf6c-de11-be94-00142212c4b1
2007-10-21 16:55:44 +00:00
6 changed files with 80 additions and 11 deletions

View File

@@ -6,15 +6,20 @@ PHP_ARG_WITH(expect,for expect support,
[ --with-expect[=DIR] Include expect support (requires libexpect >= 5.43.0).])
if test "$PHP_EXPECT" != "no"; then
for i in $PHP_EXPECT /usr/local /usr ; do
if test -f $i/include/expect.h; then
LIBEXPECT_DIR=$i
for i in $PHP_EXPECT/include/expect.h $PHP_EXPECT/include/*/expect.h \
/usr/local/include/expect.h /usr/local/include/*/expect.h \
/usr/include/expect.h /usr/include/*/expect.h ;
do
if test -f $i; then
LIBEXPECT_INCLUDE_DIR=`dirname $i`
LIBEXPECT_DIR=`dirname $LIBEXPECT_INCLUDE_DIR`
break
fi
done
PHP_ADD_LIBRARY_WITH_PATH(expect, $LIBEXPECT_DIR/lib, EXPECT_SHARED_LIBADD)
PHP_ADD_INCLUDE($LIBEXPECT_DIR/include)
PHP_ADD_INCLUDE($LIBEXPECT_INCLUDE_DIR)
PHP_NEW_EXTENSION(expect, expect.c expect_fopen_wrapper.c, $ext_shared)
PHP_SUBST(EXPECT_SHARED_LIBADD)

View File

@@ -22,10 +22,20 @@
#include <string.h>
#include <errno.h>
ZEND_BEGIN_ARG_INFO_EX(arginfo_expect_popen, 0, 0, 1)
ZEND_ARG_INFO(0, command)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_expect_expectl, 0, 0, 2)
ZEND_ARG_INFO(0, stream)
ZEND_ARG_INFO(0, expect_cases)
ZEND_ARG_INFO(1, match)
ZEND_END_ARG_INFO()
/* {{{ expect_functions[] */
function_entry expect_functions[] = {
PHP_FE(expect_popen, NULL)
PHP_FE(expect_expectl, third_arg_force_ref)
PHP_FE(expect_popen, arginfo_expect_popen)
PHP_FE(expect_expectl, arginfo_expect_expectl)
{ NULL, NULL, NULL }
};
/* }}} */
@@ -42,7 +52,7 @@ zend_module_entry expect_module_entry = {
NULL,
NULL,
PHP_MINFO(expect),
"0.1",
PHP_EXPECT_VERSION,
STANDARD_MODULE_PROPERTIES
};
/* }}} */
@@ -143,7 +153,8 @@ PHP_MSHUTDOWN_FUNCTION(expect)
PHP_MINFO_FUNCTION(expect)
{
php_info_print_table_start();
php_info_print_table_row(2, "Expect support", "enabled");
php_info_print_table_header(2, "Expect support", "enabled");
php_info_print_table_row(2, "Version", PHP_EXPECT_VERSION);
php_info_print_table_row(2, "Stream wrapper support", "expect://");
php_info_print_table_end();
@@ -161,6 +172,7 @@ PHP_FUNCTION(expect_popen)
int command_len;
FILE *fp;
php_stream *stream = NULL;
zval *z_pid;
if (ZEND_NUM_ARGS() != 1) { WRONG_PARAM_COUNT; }
@@ -174,7 +186,13 @@ PHP_FUNCTION(expect_popen)
if (!stream) {
RETURN_FALSE;
}
stream->flags |= PHP_STREAM_FLAG_NO_SEEK;
MAKE_STD_ZVAL (z_pid);
ZVAL_LONG (z_pid, exp_pid);
stream->wrapperdata = z_pid;
php_stream_to_zval(stream, return_value);
}
/* }}} */
@@ -198,6 +216,12 @@ PHP_FUNCTION(expect_expectl)
}
php_stream_from_zval (stream, &z_stream);
if (!stream->wrapperdata) {
php_error_docref (NULL TSRMLS_CC, E_ERROR, "supplied argument is not a valid stream resource");
return;
}
if (php_stream_cast (stream, PHP_STREAM_AS_FD, (void*)&fd, REPORT_ERRORS) != SUCCESS || fd < 0) {
return;
}

View File

@@ -14,10 +14,10 @@
</maintainers>
<release>
<version>0.2.4</version>
<date>2007-10-20</date>
<version>0.2.5</version>
<date>2008-11-27</date>
<state>beta</state>
<notes>Fixed #12268 (Capturing output via exp_loguser from within PHP / Apache)
<notes>Fixed bug #14768 (configure error in Ubuntu 8.04)
</notes>
</release>

View File

@@ -35,6 +35,8 @@
extern zend_module_entry expect_module_entry;
#define phpext_expect_ptr &expect_module_entry
#define PHP_EXPECT_VERSION "0.2.5-dev"
#ifdef PHP_WIN32
#define PHP_EXPECT_API __declspec(dllexport)
#else

24
tests/bug12268.phpt Normal file
View File

@@ -0,0 +1,24 @@
--TEST--
PECL Bug #12268 CGI
--SKIPIF--
<?php if (!extension_loaded("expect") || php_sapi_name() == 'cli') print "skip"; ?>
--INI--
expect.loguser=0
expect.logfile=php://output
--FILE--
<?php
if (php_sapi_name() == 'cli') exit;
$stream = expect_popen("echo Hello");
ob_start();
expect_expectl ($stream, array());
$r = ob_get_contents();
fclose ($stream);
print "Output: $r";
?>
--EXPECT--
Output: Hello

14
tests/bug6996.phpt Normal file
View File

@@ -0,0 +1,14 @@
--TEST--
PECL Bug #6996
--SKIPIF--
<?php if (!extension_loaded("expect")) print "skip"; ?>
--FILE--
<?php
$stream = popen ("expect://echo 2>/dev/null", "r");
expect_expectl ($stream, array());
fclose ($stream);
?>
--EXPECTF--
Fatal error: expect_expectl(): supplied argument is not a valid stream resource in %s on line %d