A patch to PhD, remove the deprecated ereg_replace function call in PHP 5.3.0
| From: | Gang Chen | Date: | Tue, 23 Dec 2008 17:13:25 +0000 |
| Subject: | A patch to PhD, remove the deprecated ereg_replace function call in PHP 5.3.0 | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969379855@lists.php.net to get a copy of this message | ||
Hello,
Since the ereg_replace function is deprecated in PHP 5.3.0, when
building PHP docs with PHP 5.3.0, I got too many E_DEPRECATED
messages. To clear the boring messages, I changed the function call to
ereg_replace to preg_replace. Following is the patch:
Index: manpage.php
===================================================================
RCS file: /repository/phd/formats/manpage.php,v
retrieving revision 1.3
diff -r1.3 manpage.php
215c215
< $ret = trim(ereg_replace( "[ \n\t]+", ' ', $str));
---
> $ret = trim(preg_replace( '/[ \n\t]+/', ' ', $str));
446c446
< return trim(ereg_replace("[ \n\t]+", ' ', $value));
---
> return trim(preg_replace('/[ \n\t]+/', ' ', $value));
Index: chmsource.php
===================================================================
RCS file: /repository/phd/themes/php/chmsource.php,v
retrieving revision 1.10
diff -r1.10 chmsource.php
337,338c337,340
< $header = ereg_replace('( *)</head>','\\1 <link
media="all"
rel="stylesheet" type="text/css" href="style.css"/>
< \\1</head>', $header);
---
> $pattern = '/(.*)(\r|\n|\r\n|\n\r)(.*)<\/head>/';
> $replacement = '$1 <link media="all" rel="stylesheet"
> type="text/css" href="style.css"/>$2$3</head>';
>
> $header = preg_replace($pattern, $replacement, $header);
Regards,
Chen Gang
--
PHP Internals Study
http://www.phpinternals.com
Attachment: [application/octet-stream] chmsource.php.diff
Attachment: [application/octet-stream] manpage.php.diff
Attachment: [application/octet-stream] chmsource.php.diff
Attachment: [application/octet-stream] manpage.php.diff