php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57622 BCompiler warning when including empty file
Submitted: 2007-04-16 07:17 UTC Modified: 2007-04-22 15:54 UTC
From: kepi at igloonet dot cz Assigned: val (profile)
Status: Closed Package: bcompiler (PECL)
PHP Version: 5.2.1 OS: Debian GNU/Linux
Private report: No CVE-ID: None
 [2007-04-16 07:17 UTC] kepi at igloonet dot cz
Description:
------------
If I'm including empty file in any php script (even if it is not bcompiled) I receive warning:

PHP Warning:  bcompiler: Bad bytecode file format at 00000000 in file.php on line 1

Thanks for any help, we need to correct this bug on bcompiler side, cause we are hosting company, so make file nonempty is not good solution for us.

Reproduce code:
---------------
<?php include "empty_file.inc"; ?>

Expected result:
----------------
no error

Actual result:
--------------
PHP Warning:  bcompiler: Bad bytecode file format at 00000000 in file.php on line 1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-22 15:54 UTC] val@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.

Fixed in CVS (bcompiler.c version 1.110)

I also put the patch to fix this bug below:
--- bcompiler.c.1       Sun Apr 22 22:21:16 2007
+++ bcompiler.c Sun Apr 22 22:25:20 2007
@@ -2081,7 +2081,12 @@
        int len = 0;
        unsigned int hi, lo;

-       DESERIALIZE_SCALAR_V(&len, int, -1);
+       /* do not use macros because of empty file problem (bug #10742) */
+       /* DESERIALIZE_SCALAR_V(&len, int, -1); */
+       {
+               size_t act = php_stream_read(BCOMPILERG(stream), &len, BCOMPILERG(bcompiler_stdsize)[BCSI_int]);
+               if (act != BCOMPILERG(bcompiler_stdsize)[BCSI_int]) return -1;
+       }
        /* just a sanity check */
        if (len <= 0 || len > 0x20) {
                return -1;
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Dec 06 09:03:34 2021 UTC