6 Commits

Author SHA1 Message Date
Simon Bazley
403fa58b6f Merge pull request #3 from krejcipetr/master
Repair the returning matches
2024-08-05 11:06:50 +01:00
Simon Bazley
832872beac Merge pull request #5 from lachbaer/fix_match_array
Fix issue #4 - match array not initialized
2024-08-05 11:06:21 +01:00
Simon Bazley
3fb8cf045d Merge pull request #6 from RobWei/master
Added code support for PHP 8
2024-08-05 11:05:51 +01:00
RobWei
60eb6b9f16 Added code support for PHP 8 2024-01-23 11:17:56 +01:00
Eik Rentzow
cc2e72e3d2 Fix issue #4 - match array not initialized
Done like in function php_pcre_match_impl() of PCRE module.
2023-02-28 08:14:33 +01:00
Petr Krejčí
d19b005e00 Repair the returning matches 2022-12-13 21:55:15 +01:00
3 changed files with 23 additions and 7 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 |
+----------------------------------------------------------------------+
@@ -318,7 +318,7 @@ PHP_FUNCTION(expect_expectl)
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) {
if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "ra|z/", &z_stream, &z_cases, &z_match) == FAILURE) {
return;
}
@@ -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 */
/*