Replace PHP's realpath()

前端 未结 6 1911
悲哀的现实
悲哀的现实 2020-12-05 01:21

Apparently, realpath is very buggy. In PHP 5.3.1, it causes random crashes. In 5.3.0 and less, realpath randomly fails and returns false (for the s

6条回答
  •  生来不讨喜
    2020-12-05 02:04

    For those Zend users out there, THIS answer may help you, as it did me:

    $path = APPLICATION_PATH . "/../directory";
    $realpath = new Zend_Filter_RealPath(new Zend_Config(array('exists' => false)));
    $realpath = $realpath->filter($path);
    

提交回复
热议问题