BryanDavis has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/293894

Change subject: Update for PHP7 api changes
......................................................................

Update for PHP7 api changes

Introduce a COMPAT_RETURN_STRINGL define to provide compatibility for
compiling under PHP7. PHP7 changed the RETURN_STRINGL macro signature.
The third argument of the PHP5 macro indicates whether or not to copy
the input string. Under PHP7 the string is always copied and the
argument was dropped.

Bug: T134561
Change-Id: I97148847e5908c58db2d18f2257b84874af18a28
---
M php_wikidiff2.cpp
1 file changed, 8 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/php/wikidiff2 
refs/changes/94/293894/1

diff --git a/php_wikidiff2.cpp b/php_wikidiff2.cpp
index 48e9d93..dbbf8fa 100644
--- a/php_wikidiff2.cpp
+++ b/php_wikidiff2.cpp
@@ -12,6 +12,12 @@
 #include "TableDiff.h"
 #include "InlineDiff.h"
 
+#if PHP_MAJOR_VERSION >= 7
+#define COMPAT_RETURN_STRINGL(s, l) { RETURN_STRINGL(s, l); return; }
+#else
+#define COMPAT_RETURN_STRINGL(s, l) { RETURN_STRINGL(s, l, 1); return; }
+#endif
+
 static int le_wikidiff2;
 
 zend_function_entry wikidiff2_functions[] = {
@@ -97,7 +103,7 @@
                Wikidiff2::String text1String(text1, text1_len);
                Wikidiff2::String text2String(text2, text2_len);
                const Wikidiff2::String & ret = wikidiff2.execute(text1String, 
text2String, numContextLines);
-               RETURN_STRINGL( const_cast<char*>(ret.data()), ret.size(), 1);
+               COMPAT_RETURN_STRINGL( const_cast<char*>(ret.data()), 
ret.size());
        } catch (std::bad_alloc &e) {
                zend_error(E_WARNING, "Out of memory in wikidiff2_do_diff().");
        } catch (...) {
@@ -131,7 +137,7 @@
                Wikidiff2::String text1String(text1, text1_len);
                Wikidiff2::String text2String(text2, text2_len);
                const Wikidiff2::String& ret = wikidiff2.execute(text1String, 
text2String, numContextLines);
-               RETURN_STRINGL( const_cast<char*>(ret.data()), ret.size(), 1);
+               COMPAT_RETURN_STRINGL( const_cast<char*>(ret.data()), 
ret.size());
        } catch (std::bad_alloc &e) {
                zend_error(E_WARNING, "Out of memory in 
wikidiff2_inline_diff().");
        } catch (...) {

-- 
To view, visit https://gerrit.wikimedia.org/r/293894
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I97148847e5908c58db2d18f2257b84874af18a28
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/php/wikidiff2
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <bda...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to