PHP userland backwards compatibility layer that emulates PHP 5.5+ core functions.

⌈⌋ ⎇ branch:  upgrade.php


Check-in [0baa0bd037]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:added release information
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0baa0bd03799bc7f5d5b9500eec32b15dbc953cf
User & Date: mario 2010-06-23 01:56:33
Context
2010-06-23
02:44
corrected preg_filter() to default to array handling, regardless of input (should catch all cases now) check-in: 9849917ac7 user: mario tags: trunk
01:56
added release information check-in: 0baa0bd037 user: mario tags: trunk
01:48
use array_keys in property_exists(), because values were always NULL check-in: d32bde02c9 user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to doc/README.

448
449
450
451
452
453
454











455
456
457
458
459
460
461
bytes...



ChangeLog
---------












v16
  - json_decode() array-conversion fix by Gerhard (tinned-software.net)
  - object-oriented input $_REQUEST filter wrapper in contrib/
  - some old code moved to contrib/archive/

v15
  - moved to phpDoc comment style,







>
>
>
>
>
>
>
>
>
>
>







448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
bytes...



ChangeLog
---------

v17
  - new emulation of pspell extension using cmdline tool
  - escaping fixed in json_encode(), ignores utf-8 now
  - a few php 5.2 array functions added
  - str_getcsv, parse_ini_string, quoted_printable_encode
  - inet_pton, inet_ntop, 
  - fixes to sys_get_tmp_dir, error_get_last, property_exists, uuencode,
    get_headers, vprintf, import_request_variables
  - test-up script is now used for executing documentation tests,
    old PEAR test script is nonfunctional

v16
  - json_decode() array-conversion fix by Gerhard (tinned-software.net)
  - object-oriented input $_REQUEST filter wrapper in contrib/
  - some old code moved to contrib/archive/

v15
  - moved to phpDoc comment style,

Changes to doc/devtools/doctests.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/php -q
<?php
/*
   Makes small test scripts, which get extracted from the PHP manual
   on the fly (but not every function has one there, suddenly).
*/

#-- config
$PAUSE = 1;   // (use 3) break between tests; you should use `|less` instead
$CLEAN = 0;   // remove test scripts after use
$MANY = 1;    // create one testing script per function


#-- help
if (count($_SERVER["argv"]) < 3) {
   echo<<<END








|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/php -q
<?php
/*
   Makes small test scripts, which get extracted from the PHP manual
   on the fly (but not every function has one there, suddenly).
*/

#-- config
$PAUSE = 0;   // (use 3) break between tests; you should use `|less` instead
$CLEAN = 0;   // remove test scripts after use
$MANY = 1;    // create one testing script per function


#-- help
if (count($_SERVER["argv"]) < 3) {
   echo<<<END
53
54
55
56
57
58
59

60
61
62
63
64
65
66
67
68

69
70
71
72
73
74
75


   #-- get function names
   $funcs = emulated_functions();

   #-- generate list of really emulated functions
   $simulated = simulated();




   #-- all
   $funcs = emulated_functions();
   foreach ($funcs as $func) {

      # read from php-manual
      if ($fn = func2fn($func))

#      and $ALL || in_array($func, $simulated) )
      {
         echo "checking function '\033[31m$func\033[37m'... ";


         #-- grep example scripts
         $tests = example_scripts($func);







>








|
>







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77


   #-- get function names
   $funcs = emulated_functions();

   #-- generate list of really emulated functions
   $simulated = simulated();
   $dont = array("time_nanosleep");



   #-- all
   $funcs = emulated_functions();
   foreach ($funcs as $func) {

      # read from php-manual
      if (($fn = func2fn($func))
       and !in_array($func, $dont) )
#      and $ALL || in_array($func, $simulated) )
      {
         echo "checking function '\033[31m$func\033[37m'... ";


         #-- grep example scripts
         $tests = example_scripts($func);
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#                  "#include('$emu3');\n".
                  "error_reporting(E_ALL);\n\n".
                  "#-- example[$i] as taken from PHP manual page '$fn'\n".
                  "$script\n".
                  "\n?".">"
               );
               echo "==>\033[32m\n";
               passthru("$php $tmp");
               echo "\033[0;37m\n\n";
            }

            #-- pause before next func/script
            sleep($PAUSE);
            echo "\n-------------------------------------------------------------------\n\n";
         }







|







104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#                  "#include('$emu3');\n".
                  "error_reporting(E_ALL);\n\n".
                  "#-- example[$i] as taken from PHP manual page '$fn'\n".
                  "$script\n".
                  "\n?".">"
               );
               echo "==>\033[32m\n";
               passthru("$php $tmp 2>&1");
               echo "\033[0;37m\n\n";
            }

            #-- pause before next func/script
            sleep($PAUSE);
            echo "\n-------------------------------------------------------------------\n\n";
         }
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
   preg_match_all("/<\?php(.+?)\?".">/ms", $text, $uu);
   return($uu[1]);
}


function add_output(&$scr) {
               #-- fix output-less scripts: find last assigned-to variable name
               if (!strpos($scr, "echo") && !strpos($scr, "print")) {
                  if (preg_match('/^.+(\$[_\w\d\[\"\'\]]+)\s*=/s', $scr, $uu)) {
                     $scr .= "\n\n#-- auto-added\nprint_r($uu[1]);\n";
                  }
                  else {
                     $scr .= "\n\n#-- this script gives no useful output, or does it?";
                  }
               }







|







198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
   preg_match_all("/<\?php(.+?)\?".">/ms", $text, $uu);
   return($uu[1]);
}


function add_output(&$scr) {
               #-- fix output-less scripts: find last assigned-to variable name
               if (!preg_match("/echo|print|var_dump/", $scr)) {
                  if (preg_match('/^.+(\$[_\w\d\[\"\'\]]+)\s*=/s', $scr, $uu)) {
                     $scr .= "\n\n#-- auto-added\nprint_r($uu[1]);\n";
                  }
                  else {
                     $scr .= "\n\n#-- this script gives no useful output, or does it?";
                  }
               }