|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-04-17 22:59 UTC] iliaa@php.net
[2006-04-18 00:02 UTC] oliver dot block at lycos dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Sep 29 15:00:01 2026 UTC |
Description: ------------ preg_replace_callback returns content that should not be in memory! Reproduce code: --------------- input: 1. "Tue, 11 Apr 2006 17:09:22 GMT" 2. "Tue, 11 Apr 2006 20:26:57 +0000 (GMT)" 3. "" function check_date($s) { $muster = "/(Mon, |Tue, |Wed, |Thu, |Fri, |Sat, |Sun, )?(\d\d?) (.{3}) (\d\d\d\d) (\d\d:\d\d(:\d\d)?) (([+-](\d\d(\d\d)))|GMT)/"; $result = ""; $result = preg_replace_callback($muster, create_function('$match', '$mon = array("Jan" => "01", "Feb" => "02", "Mar" => "03", "Apr" => "04", "May" => "05", "Jun" => "06", "Jul" => "07", "Aug" => "08", "Sep" => "09", "Okt" => "10", "Nov" => "11", "Dez" => "12"); $mm = $mon[$match[3]]; return "{$match[2]}.{$mm}.{$match[4]}"; '), $s); return $result; } Expected result: ---------------- 1. "11.04.2006" 2. "11.04.2006" 3. "" Actual result: -------------- 1. "11.04.2006" 2. "11.04.2006 (GMT)" 3. ""