php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68488 When running encrypted script BLENC searches for "blenc.key_file" in a wrong dir
Submitted: 2014-11-24 07:35 UTC Modified: 2017-01-10 08:32 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: czarek dot tomczak at gmail dot com Assigned:
Status: Suspended Package: BLENC (PECL)
PHP Version: 5.4.35 OS: Windows 7 64bit
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: czarek dot tomczak at gmail dot com
New email:
PHP Version: OS:

 

 [2014-11-24 07:35 UTC] czarek dot tomczak at gmail dot com
Description:
------------
I am setting "blenc.key_file" in php.ini to a relative path:

    blenc.key_file="./__blenc_keys"

If I do so and run the encrypted script then it cannot find __blenc_keys file and an error occurs:

    Fatal error: blenc_compile: Validation of script 
    'C:\phpdesktop\phpdesktop-chrome\www\my_source_encoded.php' failed,
    cannot execute. in Unknown on line 0

It seems that when running encrypted script BLENC thinks that current directory is php/.

This behavior is inconsistent, because when running normal php script (not encrypted, resides in www/encrypt.php), then BLENC finds the blenc keys file just fine in www/ directory. But when you run encrypted "www/my_source_encoded.php" then it looks for blenc keys file in php/ directory.

I know that it's best to use an absolute path and it will work fine, but this is still a bug that can cause headache.

I can make it work with relative path using this trick:

    blenc.key_file="./../www/__blenc_keys"

This works for both cases whether BLENC thinks current directory is www/ or php/ (assuming that both these dirs have common upper directory eg. phpdesktop/www/ and phpdesktop/php/ in my case).

Tested with BLENC 1.1.4b.
Using Mongoose 3.9 webserver and PHP CGI.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-11-24 08:51 UTC] czarek dot tomczak at gmail dot com
-Summary: When running encrypted script BLENC searches for "blenc.key_file" in php/ dir +Summary: When running encrypted script BLENC searches for "blenc.key_file" in a wrong dir
 [2014-11-24 08:51 UTC] czarek dot tomczak at gmail dot com
UPDATE:
I was wrong about BLENC searching for blenc keys file in php/ directory, when running encrypted script. It really looks for that file in application's executable directory. In my case I'm using PHP Desktop GUI framework to create a desktop application. The structure of files/dirs is following:

    phpdesktop/
    phpdesktop/phpdesktop-chrome.exe
    phpdesktop/php/
    phpdesktop/www/

When "blenc.key_file" is set to "./__blenc_keys" and running "phpdesktop/www/my_source_encoded.php" then BLENC expects the file to be in this path:

    phpdesktop/__blenc_keys
 [2017-01-10 08:32 UTC] kalle@php.net
-Status: Open +Status: Suspended
 [2017-01-10 08:32 UTC] kalle@php.net
I'm suspending the reports for BLENC as it doesn't seem to have stalled (looking at both repositories I could find on git.php.net and github) and it does not seem compatible with any currently supported version of PHP either. Please unsuspend in case someone takes over this extension
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC