[xdebug-dev] svn: /xdebug/trunk/ tests/bug00570.phpt xdebug_compat.c xdebug_compat.h xdebug_stack.c

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Thu, 22 Apr 2010 21:33:36 +0000

derick Thu, 22 Apr 2010 21:33:35 +0000

Revision: http://svn.xdebug.org/cgi-bin/viewvc.cgi?view=rev&revision=3268&root=xdebug

Log:
- Fixed bug #570: undefined symbol: zend_memrchr.

Changed paths:
    A xdebug/trunk/tests/bug00570.phpt
    U xdebug/trunk/xdebug_compat.c
    U xdebug/trunk/xdebug_compat.h
    U xdebug/trunk/xdebug_stack.c

Added: xdebug/trunk/tests/bug00570.phpt
===================================================================
--- xdebug/trunk/tests/bug00570.phpt (rev 0)
+++ xdebug/trunk/tests/bug00570.phpt 2010-04-22 21:33:35 UTC (rev 3268)
@@ -0,0 +1,19 @@
+--TEST--
+Test for bug #570: undefined symbol: zend_memrchr
+--INI--
+xdebug.default_enable=1
+--FILE--
+<?php
+function foo() {
+ throw new Exception();
+}
+foo();
+?>
+--EXPECTF--
+Fatal error: Uncaught exception 'Exception' in %sbug00570.php on line 3
+
+Exception: in %sbug00570.php on line 3
+
+Call Stack:
+%w%f %w%d 1. {main}() %sbug00570.php:0
+%w%f %w%d 2. foo() %sbug00570.php:5

Modified: xdebug/trunk/xdebug_compat.c
===================================================================
--- xdebug/trunk/xdebug_compat.c 2010-04-22 16:26:22 UTC (rev 3267)
+++ xdebug/trunk/xdebug_compat.c 2010-04-22 21:33:35 UTC (rev 3268)
@@ -52,7 +52,25 @@
 }
 #endif

+#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1
+void *php_zend_memrchr(const void *s, int c, size_t n)
+{
+ register unsigned char *e;

+ if (n <= 0) {
+ return NULL;
+ }
+
+ for (e = (unsigned char *)s + n - 1; e >= (unsigned char *)s; e--) {
+ if (*e == (unsigned char)c) {
+ return (void *)e;
+ }
+ }
+
+ return NULL;
+}
+#endif
+
 #define T(offset) (*(temp_variable *)((char *) Ts + offset))

 zval *xdebug_zval_ptr(znode *node, temp_variable *Ts TSRMLS_DC)

Modified: xdebug/trunk/xdebug_compat.h
===================================================================
--- xdebug/trunk/xdebug_compat.h 2010-04-22 16:26:22 UTC (rev 3267)
+++ xdebug/trunk/xdebug_compat.h 2010-04-22 21:33:35 UTC (rev 3268)
@@ -22,14 +22,15 @@
 #include "php.h"

 #if PHP_MAJOR_VERSION >= 6
-
 void xdebug_php_var_dump(zval **struc, int level TSRMLS_DC);
-
 #else
-
 # include "ext/standard/php_var.h"
 # define xdebug_php_var_dump php_var_dump
+#endif

+#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1
+# define zend_memrchr php_zend_memrchr
+void *php_zend_memrchr(const void *s, int c, size_t n);
 #endif



Modified: xdebug/trunk/xdebug_stack.c
===================================================================
--- xdebug/trunk/xdebug_stack.c 2010-04-22 16:26:22 UTC (rev 3267)
+++ xdebug/trunk/xdebug_stack.c 2010-04-22 21:33:35 UTC (rev 3268)
@@ -18,6 +18,7 @@
 #include "php_xdebug.h"
 #include "xdebug_private.h"
 #include "xdebug_code_coverage.h"
+#include "xdebug_compat.h"
 #include "xdebug_profiler.h"
 #include "xdebug_stack.h"
 #include "xdebug_str.h"
Received on Thu Apr 22 2010 - 22:33:36 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST