@@ -0,0 +1,350 @@
+diff -Naru php5/expect-0.3.3/expect.c php7/expect-0.3.3/expect.c
+--- php5/expect-0.3.3/expect.c 2017-05-31 13:07:17.684332564 +0200
++++ php7/expect-0.3.3/expect.c 2017-05-31 13:27:17.657306442 +0200
+@@ -92,7 +92,11 @@
+ static PHP_INI_MH(OnSetExpectTimeout)
+ {
+ if (new_value) {
++#if PHP_MAJOR_VERSION >= 7
++ exp_timeout = atoi(ZSTR_VAL(new_value));
++#else
+ exp_timeout = atoi(new_value);
++#endif
+ return SUCCESS;
+ }
+ return FAILURE;
+@@ -104,7 +108,11 @@
+ static PHP_INI_MH(OnSetExpectMatchMax)
+ {
+ if (new_value) {
++#if PHP_MAJOR_VERSION >= 7
++ exp_match_max = atoi(ZSTR_VAL(new_value));
++#else
+ exp_match_max = atoi(new_value);
++#endif
+ return SUCCESS;
+ }
+ return FAILURE;
+@@ -117,10 +125,17 @@
+ static PHP_INI_MH(OnSetExpectLogUser)
+ {
+ if (new_value) {
++#if PHP_MAJOR_VERSION >= 7
++ if (strncasecmp("on", ZSTR_VAL(new_value), sizeof("on")) == 0
++ || strncasecmp("true", ZSTR_VAL(new_value), sizeof("true")) == 0
++ || strncasecmp("yes", ZSTR_VAL(new_value), sizeof("yes")) == 0
++ || strncasecmp("1", ZSTR_VAL(new_value), sizeof("1")) == 0) {
++#else
+ if (strncasecmp("on", new_value, sizeof("on")) == 0
+ || strncasecmp("true", new_value, sizeof("true")) == 0
+ || strncasecmp("yes", new_value, sizeof("yes")) == 0
+ || strncasecmp("1", new_value, sizeof("1")) == 0) {
++#endif
+ exp_loguser = 1;
+ } else {
+ exp_loguser = 0;
+@@ -139,8 +154,13 @@
+ if (EXPECT_G(logfile_stream)) {
+ php_stream_close(EXPECT_G(logfile_stream));
+ }
++#if PHP_MAJOR_VERSION >= 7
++ if (ZSTR_LEN(new_value) > 0) {
++ php_stream* stream = php_stream_open_wrapper (ZSTR_VAL(new_value), "a", 0, NULL);
++#else
+ if (new_value_length > 0) {
+ php_stream* stream = php_stream_open_wrapper (new_value, "a", 0, NULL);
++#endif
+ if (!stream) {
+ php_error_docref (NULL TSRMLS_CC, E_ERROR, "could not open log file for writing");
+ return FAILURE;
+@@ -194,7 +214,7 @@
+ "Unable to initialize Expect: %s", Tcl_GetStringResult (interp));
+ return FAILURE;
+ }
+-
++
+ return SUCCESS;
+ }
+ /* }}} */
+@@ -206,7 +226,7 @@
+ php_unregister_url_stream_wrapper("expect" TSRMLS_CC);
+
+ UNREGISTER_INI_ENTRIES();
+-
++
+ return SUCCESS;
+ }
+ /* }}} */
+@@ -231,19 +251,32 @@
+ */
+ PHP_FUNCTION(expect_popen)
+ {
++#if PHP_MAJOR_VERSION >= 7
++ zend_string *command = NULL;
++ zval z_pid;
++#else
+ char *command = NULL;
+ int command_len;
++ zval *z_pid;
++#endif
+ FILE *fp;
+ php_stream *stream = NULL;
+- zval *z_pid;
+
+ if (ZEND_NUM_ARGS() != 1) { WRONG_PARAM_COUNT; }
+
++#if PHP_MAJOR_VERSION >= 7
++ if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "S", &command) == FAILURE) {
++#else
+ if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "s", &command, &command_len) == FAILURE) {
++#endif
+ return;
+ }
+
++#if PHP_MAJOR_VERSION >= 7
++ if ((fp = exp_popen (ZSTR_VAL(command))) != NULL) {
++#else
+ if ((fp = exp_popen (command)) != NULL) {
++#endif
+ stream = php_stream_fopen_from_pipe (fp, "");
+ }
+ if (!stream) {
+@@ -252,8 +285,12 @@
+
+ stream->flags |= PHP_STREAM_FLAG_NO_SEEK;
+
++#if PHP_MAJOR_VERSION >= 7
++ ZVAL_LONG (&z_pid, exp_pid);
++#else
+ MAKE_STD_ZVAL (z_pid);
+ ZVAL_LONG (z_pid, exp_pid);
++#endif
+ stream->wrapperdata = z_pid;
+
+ php_stream_to_zval(stream, return_value);
+@@ -267,20 +304,32 @@
+ PHP_FUNCTION(expect_expectl)
+ {
+ struct exp_case *ecases, *ecases_ptr, matchedcase;
++#if PHP_MAJOR_VERSION >= 7
++ zval *z_stream, *z_cases, *z_match=NULL, *z_case, *z_value;
++#else
+ zval *z_stream, *z_cases, *z_match=NULL, **z_case, **z_value;
++#endif
+ php_stream *stream;
+ int fd, argc;
+ ulong key;
+-
++
+ if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3) { WRONG_PARAM_COUNT; }
+
+ if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "ra|z", &z_stream, &z_cases, &z_match) == FAILURE) {
+ return;
+ }
+
++#if PHP_MAJOR_VERSION >= 7
++ php_stream_from_zval (stream, z_stream);
++#else
+ php_stream_from_zval (stream, &z_stream);
++#endif
+
++#if PHP_MAJOR_VERSION >= 7
++ if (!&(stream->wrapperdata)) {
++#else
+ if (!stream->wrapperdata) {
++#endif
+ php_error_docref (NULL TSRMLS_CC, E_ERROR, "supplied argument is not a valid stream resource");
+ return;
+ }
+@@ -295,12 +344,21 @@
+
+ zend_hash_internal_pointer_reset (Z_ARRVAL_P(z_cases));
+
++#if PHP_MAJOR_VERSION >= 7
++ while ((z_case = zend_hash_get_current_data (Z_ARRVAL_P(z_cases))) != NULL)
++ {
++ zval *z_pattern, *z_exp_type;
++ zend_hash_get_current_key(Z_ARRVAL_P(z_cases), NULL, &key);
++
++ if (Z_TYPE_P(z_case) != IS_ARRAY) {
++#else
+ while (zend_hash_get_current_data (Z_ARRVAL_P(z_cases), (void **)&z_case) == SUCCESS)
+ {
+ zval **z_pattern, **z_exp_type;
+ zend_hash_get_current_key(Z_ARRVAL_P(z_cases), NULL, &key, 0);
+
+ if (Z_TYPE_PP(z_case) != IS_ARRAY) {
++#endif
+ efree (ecases);
+ php_error_docref (NULL TSRMLS_CC, E_ERROR, "expect case must be an array");
+ return;
+@@ -310,20 +368,36 @@
+ ecases_ptr->type = exp_glob;
+
+ /* Gather pattern */
++#if PHP_MAJOR_VERSION >= 7
++ if ((z_pattern = zend_hash_index_find(Z_ARRVAL_P(z_case), 0)) == NULL) {
++#else
+ if (zend_hash_index_find(Z_ARRVAL_PP(z_case), 0, (void **)&z_pattern) != SUCCESS) {
++#endif
+ efree (ecases);
+ php_error_docref (NULL TSRMLS_CC, E_ERROR, "missing parameter for pattern at index: 0");
+ return;
+ }
++#if PHP_MAJOR_VERSION >= 7
++ if (Z_TYPE_P(z_pattern) != IS_STRING) {
++#else
+ if (Z_TYPE_PP(z_pattern) != IS_STRING) {
++#endif
+ efree (ecases);
|