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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
35 - 34 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Apr 19 06:01:29 2024 UTC