xref: /PHP-8.3/ext/pcre/tests/bug21758.phpt (revision 782352c5)
1--TEST--
2Bug #21758 (preg_replace_callback() not working with class methods)
3--FILE--
4<?php
5  class Foo {
6    function __construct() {
7
8      $s = 'preg_replace() is broken';
9
10      var_dump(preg_replace_callback(
11              '/broken/',
12              array(&$this, 'bar'),
13              $s
14           ));
15    }
16
17    function bar() {
18      return 'working';
19    }
20
21  } // of Foo
22
23  $o = new Foo;
24?>
25--EXPECT--
26string(25) "preg_replace() is working"
27