note 115360 added to function.include

From: Date: Fri, 11 Jul 2014 14:56:28 +0000
Subject: note 115360 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-199914@lists.php.net to get a copy of this message
To Windows coders, if you are upgrading from 5.3 to 5.4 or even 5.5; if you have have coded a path in your require or include you will have to be careful. Your code might not be backward compatible. To be more specific; the code escape for ESC, which is "\e" was introduced in php 5.4.4 + but if you use 5.4.3 you should be fine. For instance: Test script: ------------- <?php require("C:\element\scripts\include.php"); ?> In php 5.3.* to php 5.4.3 ---------------------------- If you use require("C:\element\scripts\include.php") it will work fine. If php 5.4.4 + It will break. ------------------------------ Warning: require(C:←lement\scripts\include.php): failed to open stream: In valid argument in C:\element\scripts\include.php on line 20 Fatal error: require(): Failed opening required 'C:←lement\scripts\include.php Solution: ----------- Theoretically, you should be always using "\\" instead of "\" when you write php in windows machine OR use "/" like in Linux and you should fine since "\" is an escape character in most programming languages. If you are not using absolute paths ; stream functions is your best friend like stream_resolve_include_path() , but you need to include the path you are resolving in you php.ini (include_path variable). I hope this makes sense and I hope it will someone sometime down the road. cheers, ---- Server IP: 216.194.115.244 Probable Submitter: 74.124.40.40 ---- Manual Page -- http://php.net/manual/en/function.include.php Edit -- https://master.php.net/note/edit/115360 Del: integrated -- https://master.php.net/note/delete/115360/integrated Del: useless -- https://master.php.net/note/delete/115360/useless Del: bad code -- https://master.php.net/note/delete/115360/bad+code Del: spam -- https://master.php.net/note/delete/115360/spam Del: non-english -- https://master.php.net/note/delete/115360/non-english Del: in docs -- https://master.php.net/note/delete/115360/in+docs Del: other reasons-- https://master.php.net/note/delete/115360 Reject -- https://master.php.net/note/reject/115360 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#199914) next »