Added code support for PHP 8

This commit is contained in:
RobWei
2024-01-23 11:17:56 +01:00
parent 9d83d267c2
commit 60eb6b9f16
3 changed files with 22 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 and 7 |
| PHP Version 5, 7 and 8 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
@@ -452,11 +452,15 @@ PHP_FUNCTION(expect_expectl)
if (z_match && exp_match && exp_match_len > 0) {
char *tmp = (char *)emalloc (sizeof(char) * (exp_match_len + 1));
strlcpy (tmp, exp_match, exp_match_len + 1);
zval_dtor (z_match);
array_init(z_match);
#if PHP_MAJOR_VERSION >= 7
z_match = zend_try_array_init(z_match);
if (!z_match) {
return;
}
add_index_string(z_match, 0, tmp);
#else
zval_dtor (z_match);
array_init(z_match);
add_index_string(z_match, 0, tmp, 1);
#endif
/* Get case that was matched */

View File

@@ -51,7 +51,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<required>
<php>
<min>4.0.0</min>
<max>7.99.99</max>
<max>8.99.99</max>
</php>
<pearinstaller>
<min>1.4.0b1</min>

View File

@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 and 7 |
| PHP Version 5, 7 and 8 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
@@ -37,7 +37,7 @@
extern zend_module_entry expect_module_entry;
#define phpext_expect_ptr &expect_module_entry
#define PHP_EXPECT_VERSION "0.3.4"
#define PHP_EXPECT_VERSION "0.4.0"
#ifdef PHP_WIN32
#define PHP_EXPECT_API __declspec(dllexport)
@@ -68,6 +68,18 @@ ZEND_END_MODULE_GLOBALS(expect)
#include "TSRM.h"
#endif /* ZTS */
#if ZEND_MODULE_API_NO >= 20190128
#ifndef TSRMLS_CC
#define TSRMLS_CC
#endif
#ifndef TSRMLS_DC
#define TSRMLS_DC
#endif
#ifndef TSRMLS_FETCH
#define TSRMLS_FETCH()
#endif
#endif
#endif /* PHP_EXPECT_H */
/*