#21758 [Opn->Csd]: PCRE functions were screwed up
| From: | moriyoshi@php.net | Date: | Mon, 20 Jan 2003 16:46:54 +0000 |
| Subject: | #21758 [Opn->Csd]: PCRE functions were screwed up | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-30682@lists.php.net to get a copy of this message | ||
ID: 21758
Updated by: moriyoshi@php.net
Reported By: daniel.gorski@develnet.org
-Status: Open
+Status: Closed
Bug Type: PCRE related
Operating System: Linux, Win32
PHP Version: 5CVS-2003-01-19 (dev)
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2003-01-20 05:23:28] daniel.gorski@develnet.org
Hi, have already pointed you to the patch that causes this. This has
been working before the patch.
I've no possibility to test it on Win32 (I've been told by Sebastian
Bergmann that it does not work there too).
As it has obviously nothing to do with ZE2, both (lastest PHP4-STABLE,
and CVS "php5" module) perish on this. Please fix this as soon as
possible.
"php4-STABLE-200301201030"
root@warpcore:/src/php4-STABLE-200301201030/sapi/cli> ./php -v
PHP 4.3.1-dev (cli) (built: Jan 20 2003 12:13:11)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
root@warpcore:/src/php4-STABLE-200301201030/sapi/cli> ./php -i | head
-13
phpinfo()
PHP Version => 4.3.1-dev
System => Linux warpcore 2.2.20 #10 Sun Nov 17 22:46:16 CET 2002 i686
Build Date => Jan 20 2003 12:09:35
Configure Command => './configure' '--enable-force-cgi-redirect'
'--with-mysql=/usr/local/mysql' '--with-config-file-path=../conf'
'--enable-trans-sid'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => ../conf
PHP API => 20020918
PHP Extension => 20020429
Zend Extension => 20021010
Debug Build => no
root@warpcore:/src/php4-STABLE-200301201030/sapi/cli> cat | ./php
<?php
class Foo {
function foo() {
$s = 'preg_replace() is broken';
echo preg_replace_callback(
'/broken/',
array(&$this, 'bar'),
$s
);
}
function bar() {
return 'working';
}
} // of Foo
$o = new Foo;
?>
Warning: preg_replace_callback() [...]: Parameter mismatch,
pattern is a string while replacement in an array. in - on line 11
----------------------------------------------------------------------
"php5" CVS module:
goosh@warpcore:/src/php5/sapi/cli> ./php -v
PHP 5.0.0-dev (cli) (built: Jan 20 2003 11:49:51)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v2.0.0-dev, Copyright (c) 1998-2003 Zend Technologies
goosh@warpcore:/src/php5/sapi/cli> ./php -i | head -13
phpinfo()
PHP Version => 5.0.0-dev
System => Linux warpcore 2.2.20 #10 Sun Nov 17 22:46:16 CET 2002 i686
Build Date => Jan 20 2003 11:46:03
Configure Command => './configure' '--enable-force-cgi-redirect'
'--with-mysql=/usr/local/mysql' '--with-config-file-path=../conf'
'--enable-trans-sid'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => ../conf
PHP API => 20020918
PHP Extension => 20020429
Zend Extension => 90021012
Debug Build => no
goosh@warpcore:/src/php5/sapi/cli> cat | ./php
<?php
class Foo {
function foo() {
$s = 'preg_replace() is broken';
echo preg_replace_callback(
'/broken/',
array(&$this, 'bar'),
$s
);
}
function bar() {
return 'working';
}
} // of Foo
$o = new Foo;
?>
Warning: preg_replace_callback() [...]: Parameter mismatch,
pattern is a string while replacement in an array. in - on line 7
regards dtg
------------------------------------------------------------------------
[2003-01-20 00:29:46] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
To see if it's ZE2 issue or not..and also,
provide a complete, short and self-contained example script
so that we can easily reproduce the problem ourselves.
------------------------------------------------------------------------
[2003-01-19 17:16:03] daniel.gorski@develnet.org
Probably this patch screwed up preg_replace_* functions:
http://lists.php.net/article.php?group=php.cvs&article=18024
I need the functionality to pass a callback _method_ to
preg_replace_callback().
It worked usually like this (in a class):
$s = preg_replace_callback(<pattern>, array(&$this, 'callbackmethod'),
$s);
Now "array" is forbidden. Is this your intention? How to access
callback methods then?
regards dtg
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21758&edit=1