On some platforms (FreeBSD & Gentoo) proc_open() get wrong working dir if the fourth parameter $cwd not set or null

On some platforms (FreeBSD & Gentoo) proc_open() get wrong working dir if the fourth parameter $cwd not set or null