php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58079 Error in getMetadata()
Submitted: 2008-03-03 17:53 UTC Modified: 2009-02-15 01:11 UTC
From: mmacia at gmail dot com Assigned:
Status: No Feedback Package: phar (PECL)
PHP Version: 5.2.1 OS: Windows XP
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: mmacia at gmail dot com
New email:
PHP Version: OS:

 

 [2008-03-03 17:53 UTC] mmacia at gmail dot com
Description:
------------
I have a Phar file with the given stub code. This code is 
accessed by an ajax script several times per minute.

Sometimes (randomly) the method getMetadata() returns null 
instead the stored metadata. I think that it's a kind of 
race condition because if I append a usleep(50) before 
execute the getMetaData() method, works.


Reproduce code:
---------------
<?php
try
{
	$__phar = new Phar(__FILE__);
	$m = $__phar->getMetaData();
	require 'phar://' . __FILE__ . '/' . $m['bootstrap'];
}
catch ( PharException $e )
{
	echo $e->getMessage();
	die('Fatal error while initializing package ' . basename(__FILE__));
}
__HALT_COMPILER();


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-22 18:17 UTC] greg at chiaraquartet dot net
can you give me information on the sapi you are running your web server as, and might I also suggest you hardcode the bootstrap unless it is changing from run to run?  This will result in a much more efficient run.

The metadata should be used to store data that is not easy to access.  Executable file paths tend to be relatively static, I use metadata to store the name of package.xml in PEAR 2.0 packages, because the name changes for each package release, and is accessed externally, not within the phar itself.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC