php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #68487 blenc_encrypt() expects php source code to not contain any php tags
Submitted: 2014-11-24 07:04 UTC Modified: 2017-01-10 08:32 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
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:04 UTC] czarek dot tomczak at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.blenc-encrypt
---

Example #1 from manpage encrypts script fine, but when you run the encrypted php script then you get an error:

    Parse error: syntax error, unexpected '<' 
    in C:\phpdesktop\phpdesktop-chrome\www\my_source_encoded.php on line 1

It seems that blenc_encrypt() expects source code to not contain any php tags. After removing php opening and closing tags in "my_source_to_protect.php" the encrypted script will run fine.

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

Test script:
---------------
<?php
// This is Example #1 from blenc_encrypt manual page.
$source_code = file_get_contents("my_source_to_protect.php");
$redistributable_key = blenc_encrypt($source_code, "my_source_encoded.php");
$key_file = ini_get('blenc.key_file');
file_put_contents($key_file, $redistributable_key, FILE_APPEND);
?>

Expected result:
----------------
Printing a secret string: XuXuXaaa

Actual result:
--------------
Parse error: syntax error, unexpected '<' 
in C:\phpdesktop\phpdesktop-chrome\www\my_source_encoded.php on line 1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-17 11:10 UTC] pasanen dot tuukka at gmail dot com
I've been solving this specific problem by myself and have patched version of this at: https://github.com/illuusio/pecl-php-blenc. If you like to test patched version of blec_encode.php version. It's not 100% working but should make thinks work.
 [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: Sun Dec 22 06:01:30 2024 UTC