Permalink
Browse files

MDL-20821 reverting untested ereg cleanup, not acceptable for stable,…

… sorry
  • Loading branch information...
1 parent 426e269 commit 199be8868e4f8ec4efdf8e36c0086772e9f65382 @skodak skodak committed Nov 19, 2009
@@ -376,7 +376,7 @@ function UnixDate($v)
global $ADODB_sybase_mths;
//Dec 30 2000 12:00AM
- if (!preg_match( "#([A-Za-z]{3})[-/\. ]+([0-9]{1,2})[-/\. ]+([0-9]{4})#"
+ if (!ereg( "([A-Za-z]{3})[-/\. ]+([0-9]{1,2})[-/\. ]+([0-9]{4})"
,$v, $rr)) return parent::UnixDate($v);
if ($rr[3] <= TIMESTAMP_FIRST_YEAR) return 0;
@@ -393,7 +393,7 @@ function UnixTimeStamp($v)
global $ADODB_sybase_mths;
//11.02.2001 Toni Tunkkari toni.tunkkari@finebyte.com
//Changed [0-9] to [0-9 ] in day conversion
- if (!preg_match( "#([A-Za-z]{3})[-/\. ]([0-9 ]{1,2})[-/\. ]([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})#"
+ if (!ereg( "([A-Za-z]{3})[-/\. ]([0-9 ]{1,2})[-/\. ]([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})"
,$v, $rr)) return parent::UnixTimeStamp($v);
if ($rr[3] <= TIMESTAMP_FIRST_YEAR) return 0;
@@ -30,49 +30,3 @@ Our changes:
skodak, iarenaza, moodler, stronk7
$Id$
-
-
-18 Nov 2009
-Description of modifications to remove ereg related functions deprecated as of php 5.3. Patch below.
-
-Index: drivers/adodb-sybase.inc.php
-===================================================================
-RCS file: /cvsroot/moodle/moodle/lib/adodb/drivers/adodb-sybase.inc.php,v
-retrieving revision 1.21.6.2
-diff -u -r1.21.6.2 adodb-sybase.inc.php
---- drivers/adodb-sybase.inc.php 15 Feb 2008 06:04:06 -0000 1.21.6.2
-+++ drivers/adodb-sybase.inc.php 18 Nov 2009 06:15:43 -0000
-@@ -376,7 +376,7 @@
- global $ADODB_sybase_mths;
-
- //Dec 30 2000 12:00AM
-- if (!ereg( "([A-Za-z]{3})[-/\. ]+([0-9]{1,2})[-/\. ]+([0-9]{4})"
-+ if (!preg_match( "#([A-Za-z]{3})[-/\. ]+([0-9]{1,2})[-/\. ]+([0-9]{4})#"
- ,$v, $rr)) return parent::UnixDate($v);
-
- if ($rr[3] <= TIMESTAMP_FIRST_YEAR) return 0;
-@@ -393,7 +393,7 @@
- global $ADODB_sybase_mths;
- //11.02.2001 Toni Tunkkari toni.tunkkari@finebyte.com
- //Changed [0-9] to [0-9 ] in day conversion
-- if (!ereg( "([A-Za-z]{3})[-/\. ]([0-9 ]{1,2})[-/\. ]([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})"
-+ if (!preg_match( "#([A-Za-z]{3})[-/\. ]([0-9 ]{1,2})[-/\. ]([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})#"
- ,$v, $rr)) return parent::UnixTimeStamp($v);
- if ($rr[3] <= TIMESTAMP_FIRST_YEAR) return 0;
-
-Index: session/old/adodb-session-clob.php
-===================================================================
-RCS file: /cvsroot/moodle/moodle/lib/adodb/session/old/Attic/adodb-session-clob.php,v
-retrieving revision 1.5.6.1
-diff -u -r1.5.6.1 adodb-session-clob.php
---- session/old/adodb-session-clob.php 15 Feb 2008 06:04:08 -0000 1.5.6.1
-+++ session/old/adodb-session-clob.php 18 Nov 2009 06:15:43 -0000
-@@ -439,7 +439,7 @@
- if (0) {
-
- session_start();
-- session_register('AVAR');
-+ session_register('AVAR');//this is deprecated in php 5.3
- $_SESSION['AVAR'] += 1;
- ADOConnection::outp( "
- -- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>",false);
@@ -439,7 +439,7 @@ function adodb_sess_gc($maxlifetime)
if (0) {
session_start();
- session_register('AVAR');//this is deprecated in php 5.3
+ session_register('AVAR');
$_SESSION['AVAR'] += 1;
ADOConnection::outp( "
-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>",false);
View
@@ -173,8 +173,8 @@ function blocks_name_allowed_in_format($name, $pageformat) {
$depth = -1;
if ($formats = block_method_result($name, 'applicable_formats')) {
foreach($formats as $format => $allowed) {
- $thisformat = '/^'.str_replace('*', '[^-]*', $format).'.*$/';
- if(preg_match($thisformat, $pageformat)) {
+ $thisformat = '^'.str_replace('*', '[^-]*', $format).'.*$';
+ if(ereg($thisformat, $pageformat)) {
if(($scount = substr_count($format, '-')) > $depth) {
$depth = $scount;
$accept = $allowed;
@@ -175,7 +175,7 @@ function create_session_and_responses(&$question, &$state, $cmoptions, $attempt)
while ($wrappedquestion =
array_pop($this->catrandoms[$question->category][$question->questiontext])) {
- if (!preg_match("/(^|,)$wrappedquestion->id(,|$)/", $cmoptions->questionsinuse)) {
+ if (!ereg("(^|,)$wrappedquestion->id(,|$)", $cmoptions->questionsinuse)) {
/// $randomquestion is not in use and will therefore be used
/// as the randomquestion here...
$wrappedquestion = get_record('question', 'id', $wrappedquestion->id);
@@ -216,7 +216,7 @@ function restore_session_and_responses(&$question, &$state) {
/// the other question types in that it now only needs one response
/// record per question.
global $QTYPES;
- if (!preg_match('/^random([0-9]+)-(.*)$/', $state->responses[''], $answerregs)) {
+ if (!ereg('^random([0-9]+)-(.*)$', $state->responses[''], $answerregs)) {
if (empty($state->responses[''])) {
// This is the case if there weren't enough questions available in the category.
$question->questiontext = '<span class="notifyproblem">'.
@@ -361,7 +361,7 @@ function restore_recode_answer($state, $restore) {
global $QTYPES;
$answer_field = "";
- if (preg_match('/^random([0-9]+)-(.*)$/', $state->answer, $answerregs)) {
+ if (ereg('^random([0-9]+)-(.*)$', $state->answer, $answerregs)) {
// Recode the question id in $answerregs[1]
// Get the question from backup_ids
if(!$wrapped = backup_getid($restore->backup_unique_code,"question",$answerregs[1])) {

0 comments on commit 199be88

Please sign in to comment.