source: php/trunk/doxygen/doc_page_appedix_arc2patch.php

Last change on this file was 43, checked in by cla, 14 years ago

rdfint

  • added note to ARC2 Patch page on exact PHP version that the patch is currently required for under windows operating systems
  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1<?PHP
2
3/* RDFInt.php - RDF Interfaces for PHP
4 * Copyright 2011 netlabs.org
5 * Author: Christian Langanke, Adrian Gschwend
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20/**
21 * @page page_appendix_arc2_patch Appendix: Patch for ARC2 for usage under Windows operating systems
22 *
23 * For usage under Windows operating systems, the method
24 * ARC2_Class::calcBase($path) needs a patch in order to cope with
25 * Windows style pathnames including backslashes.
26 *
27 * The reason for this is that the PHP function \c realpath returns
28 * path names including backslashes. Such path names are however invalid
29 * for other PHP functions. As the time of this writing, this behaviour
30 * has been reproduced up to PHP V5.3.5..
31 *
32 * The patched method from v2.0.0-0-g270696b looks as follows:
33\code
34 function calcBase($path) {
35 $r = $path;
36 $r = preg_replace('/\#.*$/', '', $r);/* remove hash */
37 $r = preg_replace('/^\/\//', 'http://', $r);/* net path (//), assume http */
38 if (preg_match('/^[a-z0-9]+\:/', $r)) {/* scheme, abs path */
39 while (preg_match('/^(.+\/)(\.\.\/.*)$/U', $r, $m)) {
40 $r = $this->calcURI($m[1], $m[2]);
41 }
42 return $r;
43 }
44 // return realpath, but take care for windows systems
45 $realpath = realpath($r);
46 if (substr( realpath($r), 1, 2) == ':\\')
47 $realpath = str_replace( '\\', '/', $realpath);
48 return 'file://' . $realpath;/* real path */
49 }
50\endcode
51 */
52
53
54?>
Note: See TracBrowser for help on using the repository browser.