@@ -289,7 +289,23 @@ private void InitConstants(DualDictionary<string, object> _constants)
289
289
_constants . Add ( "PHP_RELEASE_VERSION" , PhpVersion . Release , false ) ;
290
290
_constants . Add ( "PHP_VERSION_ID" , PhpVersion . Major * 10000 + PhpVersion . Minor * 100 + PhpVersion . Release , false ) ;
291
291
_constants . Add ( "PHP_EXTRA_VERSION" , PhpVersion . Extra , false ) ;
292
- _constants . Add ( "PHP_OS" , Environment . OSVersion . Platform == PlatformID . Win32NT ? "WINNT" : "WIN32" , false ) ; // TODO: GENERICS (Unix)
292
+
293
+ string php_os = "Unknown" ;
294
+ switch ( Environment . OSVersion . Platform )
295
+ {
296
+ case PlatformID . Win32NT :
297
+ php_os = "WINNT" ;
298
+ break ;
299
+ case PlatformID . Win32S :
300
+ case PlatformID . Win32Windows :
301
+ case PlatformID . WinCE :
302
+ php_os = "WIN32" ;
303
+ break ;
304
+ case PlatformID . Unix :
305
+ php_os = "Linux" ;
306
+ break ;
307
+ }
308
+ _constants . Add ( "PHP_OS" , php_os , false ) ;
293
309
_constants . Add ( "PHP_SAPI" , ( System . Web . HttpContext . Current == null ) ? "cli" : "isapi" , false ) ;
294
310
_constants . Add ( "DIRECTORY_SEPARATOR" , FullPath . DirectorySeparatorString , false ) ;
295
311
_constants . Add ( "PATH_SEPARATOR" , Path . PathSeparator . ToString ( ) , false ) ;
@@ -574,6 +590,14 @@ public object DynamicInclude(
574
590
DTypeDesc includer ,
575
591
InclusionTypes inclusionType )
576
592
{
593
+ if ( Environment . OSVersion . Platform == PlatformID . Unix )
594
+ {
595
+ // Fix for absolute-path-includes on Unix filesystems.
596
+ // Example: include_once('/path/app\libs\include.php')
597
+ // HACK: Translate "\" to "/"
598
+ includerFileRelPath = includerFileRelPath . Replace ( '\\ ' , '/' ) ;
599
+ }
600
+
577
601
ApplicationConfiguration app_config = Configuration . Application ;
578
602
579
603
// determines inclusion behavior:
0 commit comments