php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #79935
Patch add-php7-support revision 2020-09-11 23:47 UTC by nathan dot renniewaldock+php at gmail dot com

Patch add-php7-support for ncurses Bug #79935

Patch version 2020-09-11 23:47 UTC

Return to Bug #79935 | Download this patch
Patch Revisions:

Developer: nathan.renniewaldock+php@gmail.com

Index: ncurses_functions.c
===================================================================
--- ncurses_functions.c	(revision 350547)
+++ ncurses_functions.c	(working copy)
@@ -163,15 +163,17 @@
 		*pscr = stdscr;
 		zscr = zend_register_resource(pscr, le_ncurses_windows);
 		ZVAL_RES(&c.value, zscr);
+#if PHP_MAJOR_VERSION > 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION >= 3)
+		int module_number = ZEND_CONSTANT_MODULE_NUMBER(&c);
+		ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, module_number);
+#else
+		int module_number = c.module_number;
 		c.flags = CONST_CS;
+#endif
 		c.name = zend_string_init("STDSCR", sizeof("STDSCR")-1, 0);
 		zend_register_constant(&c);
 
-#define PHP_NCURSES_DEF_CONST(x)    \
-		ZVAL_LONG(&c.value, x);         \
-		c.flags = CONST_CS;         \
-		c.name = zend_string_init("NCURSES_" #x, sizeof("NCURSES_" #x)-1, 0); \
-		zend_register_constant(&c)
+#define PHP_NCURSES_DEF_CONST(x)  REGISTER_LONG_CONSTANT("NCURSES_"#x, x, CONST_CS)
 #else
 		zval *zscr;
 
@@ -2668,7 +2670,11 @@
 	if (above) {
 #if PHP_MAJOR_VERSION >= 7
 		zend_resource *id = (zend_resource *)panel_userptr(above);
+#if PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION < 3
 		GC_REFCOUNT(id)++;
+#else
+		GC_ADDREF(id);
+#endif
 		RETURN_RES(id);
 #else
 		long id = (long)panel_userptr(above);
@@ -2702,7 +2708,11 @@
 	if (below) {
 #if PHP_MAJOR_VERSION >= 7
 		zend_resource *id = (zend_resource *)panel_userptr(below);
+#if PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION < 3
 		GC_REFCOUNT(id)++;
+#else
+		GC_ADDREF(id);
+#endif
 		RETURN_RES(id);
 #else
 		long id = (long)panel_userptr(below);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 06 07:01:27 2024 UTC