symisc / PH7

An Embedded Implementation of PHP (C Library)
http://ph7.symisc.net
Other
494 stars 68 forks source link

Unable to include more than 1 file from PH7_VM_CONFIG_IMPORT_PATH. #20

Open Maxwell175 opened 6 years ago

Maxwell175 commented 6 years ago

Hello,

I discovered this strange, obscure bug where the second include/require of a file from the PH7_VM_CONFIG_IMPORT_PATH doesn't work. After some investigation, I found that when PH7_StreamOpenHandle is called for the second include, SySetGetNextEntry returns garbage on the second round of the while loop (first time it correctly returns ./).

I just can't seem to find the root of this problem, though. My temporary mitigation is to chdir to the import path, but that's just not right.

Thanks

Using latest version built with -DPH7_ENABLE_THREADS -DMAP_FILE=0x0001. Run on Ubuntu 18.04 x64.

symisc commented 6 years ago

Could you post the chunk of code you used to produce such behavior?

Maxwell175 commented 6 years ago

This is an open source project, so I'll just link you to it.

Actual PH7 implementation: https://github.com/MDTech-us-MAN/SSNFS/blob/326d73544629fef0cb58ae18cf5dd6fab4b80d58/SSNFSd/ssnfswebworker.cpp#L282 Sample PHP file: https://github.com/MDTech-us-MAN/SSNFS/blob/326d73544629fef0cb58ae18cf5dd6fab4b80d58/SSNFSd/webpanel/index.php

symisc commented 6 years ago

If the first file is included correctly and not the second. Are you sure that this file is accessible (permissions, etc.). Try using _requireonce, include directive instead to check if the problem persists.

Maxwell175 commented 6 years ago

I tried both already. This is definitely not a permissions problem, since it works just fine if I chdir (cd) to the same import directory.

Maxwell.

On May 17, 2018, 6:21 AM, at 6:21 AM, Symisc Systems notifications@github.com wrote:

If the first file is included correctly and not the second. Are you sure that this file is accessible (permissions, etc.). Try using _requireonce, include directive instead to check if the problem persists.

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/symisc/PH7/issues/20#issuecomment-389819365

symisc commented 6 years ago

Did you configure PH7_VM_CONFIG_IMPORT_PATH with the target path in your code? I did not see any reference to it in your code.

Maxwell175 commented 6 years ago

Yes. I did and like I said, it worked just fine for the first include.

On May 17, 2018, 9:51 AM, at 9:51 AM, Symisc Systems notifications@github.com wrote:

Did you configure PH7_VM_CONFIG_IMPORT_PATH with the target path in your code? I did not see any reference to it in your code.

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/symisc/PH7/issues/20#issuecomment-389873462