Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • Saransaran/php-class-project
  • sibidharan/php-class-project
  • Madhan1024/php-class-project
  • GopiKrishnan/photogram
  • Mhd_khalid/php-class-project
  • At_muthu__/php-class-project
  • jaganbhaskar155/php-class-project
  • hariharanrd/php-class-project
  • jasper715/php-class-project
  • hanuRakesh/photogram-project-main
  • Yuvaraj21/photogram
  • ram_rogers/php-class-project
  • Hihelloboy/php-class-project
  • Nadarajan/php-class-project
  • srisanthosh156/php-class-project
  • Buvaneshwaran.k/php-class-project
  • umarfarooq07/php-class-project
  • Dhanaprakash/php-class-project
  • jashwanth142003/php-class-project
  • Esakkiraja/php-class-project
  • Boomi/php-class-project
  • Kishore2071/php-class-project
  • Ram123raj/php-class-project
  • aswinkumar27/php-class-project
  • dhilipdhilip9655/php-class-project
  • Manikandam143/php-class-project
  • VikramS/php-class-project
  • ArnoldSam/php-class-project
  • gowthamapandi0008/php-class-project
  • d.barath7639/php-class-project
  • shyalandran/php-class-project
  • kiruba_432/php-class-project
  • razakias001/php-class-project
  • kannan.b2745/php-class-project
  • sathish236tsk/php-class-project
  • rii/php-class-project
  • jonathajh4k/php-class-project
  • Neelagandan_G/php-class-project
  • Tholkappiar2003/php-class-project
  • kamaleshselvam75/php-class-project
  • devapriyan/php-class-project
  • sanojahamed/php-class-project
  • rizwankendo/php-class-project
  • senthamilselvan18000/php-class-project
  • rajeshd01/php-class-project
  • Florence/php-class-project
  • vishnu191299/php-class-project
  • Rakeshrakki/php-class-project
  • sanjay057/php-class-project
  • amarsanthoshsanthosh/photogram-project-cp
  • md_ashmar/php-class-project
  • k.nandhishwaran777k/php-class-project
52 results
Show changes
Showing
with 6006 additions and 0 deletions
<?php
/**
* Random_* Compatibility Library
* for using the new PHP 7 random_* API in PHP 5 projects
*
* @version 2.99.99
* @released 2018-06-06
*
* The MIT License (MIT)
*
* Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
// NOP
<?php
$dist = dirname(__DIR__).'/dist';
if (!is_dir($dist)) {
mkdir($dist, 0755);
}
if (file_exists($dist.'/random_compat.phar')) {
unlink($dist.'/random_compat.phar');
}
$phar = new Phar(
$dist.'/random_compat.phar',
FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::KEY_AS_FILENAME,
'random_compat.phar'
);
rename(
dirname(__DIR__).'/lib/random.php',
dirname(__DIR__).'/lib/index.php'
);
$phar->buildFromDirectory(dirname(__DIR__).'/lib');
rename(
dirname(__DIR__).'/lib/index.php',
dirname(__DIR__).'/lib/random.php'
);
/**
* If we pass an (optional) path to a private key as a second argument, we will
* sign the Phar with OpenSSL.
*
* If you leave this out, it will produce an unsigned .phar!
*/
if ($argc > 1) {
if (!@is_readable($argv[1])) {
echo 'Could not read the private key file:', $argv[1], "\n";
exit(255);
}
$pkeyFile = file_get_contents($argv[1]);
$private = openssl_get_privatekey($pkeyFile);
if ($private !== false) {
$pkey = '';
openssl_pkey_export($private, $pkey);
$phar->setSignatureAlgorithm(Phar::OPENSSL, $pkey);
/**
* Save the corresponding public key to the file
*/
if (!@is_readable($dist.'/random_compat.phar.pubkey')) {
$details = openssl_pkey_get_details($private);
file_put_contents(
$dist.'/random_compat.phar.pubkey',
$details['key']
);
}
} else {
echo 'An error occurred reading the private key from OpenSSL.', "\n";
exit(255);
}
}
<?php
require_once 'lib/byte_safe_strings.php';
require_once 'lib/cast_to_int.php';
require_once 'lib/error_polyfill.php';
require_once 'other/ide_stubs/libsodium.php';
require_once 'lib/random.php';
$int = random_int(0, 65536);
<?xml version="1.0"?>
<psalm
autoloader="psalm-autoload.php"
stopOnFirstError="false"
useDocblockTypes="true"
>
<projectFiles>
<directory name="lib" />
</projectFiles>
<issueHandlers>
<RedundantConditionGivenDocblockType errorLevel="info" />
<UnresolvableInclude errorLevel="info" />
<DuplicateClass errorLevel="info" />
<InvalidOperand errorLevel="info" />
<UndefinedConstant errorLevel="info" />
<MissingReturnType errorLevel="info" />
<InvalidReturnType errorLevel="info" />
</issueHandlers>
</psalm>
# Previous releases
## 2.7.2 - 2018-02-11
[GitHub Milestone](https://github.com/php-amqplib/php-amqplib/milestone/5?closed=1)
- PHP `5.3` compatibility [PR](https://github.com/php-amqplib/php-amqplib/issues/539)
## 2.7.1 - 2018-02-01
- Support PHPUnit 6 [PR](https://github.com/php-amqplib/php-amqplib/pull/530)
- Use `tcp_nodelay` for `StreamIO` [PR](https://github.com/php-amqplib/php-amqplib/pull/517)
- Pass connection timeout to `wait` method [PR](https://github.com/php-amqplib/php-amqplib/pull/512)
- Fix possible indefinite waiting for data in StreamIO [PR](https://github.com/php-amqplib/php-amqplib/pull/423), [PR](https://github.com/php-amqplib/php-amqplib/pull/534)
- Change protected method check_heartbeat to public [PR](https://github.com/php-amqplib/php-amqplib/pull/520)
- Ensure access levels are consistent for calling `check_heartbeat` [PR](https://github.com/php-amqplib/php-amqplib/pull/535)
## 2.7.0 - 2017-09-20
### Added
- Increased overall test coverage
- Bring heartbeat support to socket connection
- Add message delivery tag for publisher confirms
- Add support for serializing DateTimeImmutable objects
### Fixed
- Fixed infinite loop on reconnect - check_heartbeat
- Fixed signal handling exit example
- Fixed exchange_unbind arguments
- Fixed invalid annotation for channel_id
- Fixed socket null error on php 5.3 version
- Fixed timeout parameters on HHVM before calling stream_select
### Changed
- declare(ticks=1) no longer needed after PHP5.3 / amqplib 2.4.1
- Minor DebugHelper improvements
### Enhancements
- Add extensions requirements to README.md
- Add PHP 7.1 to Travis build
- Reduce memory usage in StreamIO::write()
- Re-enable heartbeats after reconnection
## 2.6.3 - 2016-04-11
### Added
- Added the ability to set timeout as float
### Fixed
- Fixed restoring of error_handler on connection error
### Enhancements
- Verify read_write_timeout is at least 2x the heartbeat (if set)
- Many PHPDoc fixes
- Throw exception when trying to create an exchange on a closed connection
## 2.6.2 - 2016-03-02
### Added
- Added AMQPLazySocketConnection
- AbstractConnection::getServerProperties method to retrieve server properties.
- AMQPReader::wait() will throw IOWaitException on stream_select failure
- Add PHPDocs to Auto-generated Protocol Classes
### Fixed
- Disable heartbeat when closing connection
- Fix for when the default error handler is not restored in StreamIO
### Enhancements
- Cleanup tests and improve testing performance
- Confirm received valid frame type on wait_frame in AbstractConnection
- Update DEMO files closer to PSR-2 standards
## 2.6.1 - 2016-02-12
### Added
- Add constants for delivery modes to AMQPMessage
### Fixed
- Fix some PHPDoc problems
- AbstractCollection value de/encoding on PHP7
- StreamIO: fix "bad write retry" in SSL mode
### Enhancements
- Update PHPUnit configuration
- Add scrutinizer-ci configuration
- Organizational changes from videlalvaro to php-amqplib org
- Minor complexity optimizations, code organization, and code cleanup
## 2.6.0 - 2015-09-23
### BC Breaking Changes
- The `AMQPStreamConnection` class now throws `ErrorExceptions` when errors happen while reading/writing to the network.
### Added
- Heartbeat frames will decrease the timeout used when calling wait_channel - heartbeat frames do not reset the timeout
### Fixed
- Declared the class AbstractChannel as being an abstract class
- Reads, writes and signals respond immediately instead of waiting for a timeout
- Fatal error in some cases on Channel.wait with timeout when RabbitMQ restarted
- Remove warning when trying to push a deferred frame
This diff is collapsed.
<?php
namespace PhpAmqpLib\Channel;
use PhpAmqpLib\Wire\AMQPReader;
/**
* @link https://livebook.manning.com/book/rabbitmq-in-depth/chapter-2/v-13/22
* @link https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf 4.2.6 Content Framing
*/
final class Frame
{
public const FRAME_HEADER_SIZE = AMQPReader::OCTET + AMQPReader::SHORT + AMQPReader::LONG;
public const END = 0xCE;
public const TYPE_METHOD = 1;
public const TYPE_HEADER = 2;
public const TYPE_BODY = 3;
public const TYPE_HEARTBEAT = 8;
/** @var int */
private $type;
/** @var int */
private $channel;
/** @var int */
private $size;
/** @var string|null */
private $payload;
public function __construct(int $type, int $channel, int $size, ?string $payload = null)
{
$this->type = $type;
$this->channel = $channel;
$this->size = $size;
$this->payload = $payload;
}
/**
* @return int
*/
public function getType(): int
{
return $this->type;
}
/**
* @return int
*/
public function getChannel(): int
{
return $this->channel;
}
/**
* @return int
*/
public function getSize(): int
{
return $this->size;
}
public function getPayload(): ?string
{
return $this->payload;
}
public function isMethod(): bool
{
return $this->type === self::TYPE_METHOD;
}
public function isHeartbeat(): bool
{
return $this->type === self::TYPE_HEARTBEAT;
}
}
<?php
namespace PhpAmqpLib\Channel;
final class Method
{
/** @var int */
private $class;
/** @var int */
private $method;
/** @var string */
private $arguments;
public function __construct(int $class, int $method, string $arguments)
{
$this->class = $class;
$this->method = $method;
$this->arguments = $arguments;
}
public function getClass(): int
{
return $this->class;
}
public function getMethod(): int
{
return $this->method;
}
public function getArguments(): string
{
return $this->arguments;
}
public function getSignature(): string
{
return $this->class . ',' . $this->method;
}
}
<?php
namespace PhpAmqpLib\Connection;
use LogicException;
/**
* @since 3.2.0
*/
class AMQPConnectionFactory
{
public static function create(AMQPConnectionConfig $config): AbstractConnection
{
if ($config->getIoType() === AMQPConnectionConfig::IO_TYPE_STREAM) {
if ($config->isSecure()) {
$connection = new AMQPSSLConnection(
$config->getHost(),
$config->getPort(),
$config->getUser(),
$config->getPassword(),
$config->getVhost(),
self::getSslOptions($config),
[
'insist' => $config->isInsist(),
'login_method' => $config->getLoginMethod(),
'login_response' => $config->getLoginResponse(),
'locale' => $config->getLocale(),
'connection_timeout' => $config->getConnectionTimeout(),
'read_write_timeout' => self::getReadWriteTimeout($config),
'keepalive' => $config->isKeepalive(),
'heartbeat' => $config->getHeartbeat(),
],
$config->getNetworkProtocol(),
$config
);
} else {
$connection = new AMQPStreamConnection(
$config->getHost(),
$config->getPort(),
$config->getUser(),
$config->getPassword(),
$config->getVhost(),
$config->isInsist(),
$config->getLoginMethod(),
$config->getLoginResponse(),
$config->getLocale(),
$config->getConnectionTimeout(),
self::getReadWriteTimeout($config),
$config->getStreamContext(),
$config->isKeepalive(),
$config->getHeartbeat(),
$config->getChannelRPCTimeout(),
$config->getNetworkProtocol(),
$config
);
}
} else {
if ($config->isSecure()) {
throw new LogicException('The socket connection implementation does not support secure connections.');
}
$connection = new AMQPSocketConnection(
$config->getHost(),
$config->getPort(),
$config->getUser(),
$config->getPassword(),
$config->getVhost(),
$config->isInsist(),
$config->getLoginMethod(),
$config->getLoginResponse(),
$config->getLocale(),
$config->getReadTimeout(),
$config->isKeepalive(),
$config->getWriteTimeout(),
$config->getHeartbeat(),
$config->getChannelRPCTimeout()
);
}
return $connection;
}
private static function getReadWriteTimeout(AMQPConnectionConfig $config): float
{
return min($config->getReadTimeout(), $config->getWriteTimeout());
}
/**
* @param AMQPConnectionConfig $config
* @return mixed[]
*/
private static function getSslOptions(AMQPConnectionConfig $config): array
{
return array_filter([
'cafile' => $config->getSslCaCert(),
'capath' => $config->getSslCaPath(),
'local_cert' => $config->getSslCert(),
'local_pk' => $config->getSslKey(),
'verify_peer' => $config->getSslVerify(),
'verify_peer_name' => $config->getSslVerifyName(),
'passphrase' => $config->getSslPassPhrase(),
'ciphers' => $config->getSslCiphers(),
], static function ($value) {
return null !== $value;
});
}
}
<?php
namespace PhpAmqpLib\Connection;
/**
* @deprecated AMQPStreamConnection can be lazy too. Use AMQPConnectionFactory with AMQPConnectionConfig::setIsLazy(true)
*/
class AMQPLazyConnection extends AMQPStreamConnection
{
/**
* @inheritDoc
*/
public function connectOnConstruct(): bool
{
return false;
}
/**
* @param string[][] $hosts
* @param string[] $options
* @return self
* @throws \Exception
* @deprecated Use ConnectionFactory
*/
public static function create_connection($hosts, $options = array())
{
if (count($hosts) > 1) {
throw new \RuntimeException('Lazy connection does not support multiple hosts');
}
return parent::create_connection($hosts, $options);
}
}
<?php
namespace PhpAmqpLib\Connection;
/**
* @deprecated AMQPLazySSLConnection can be lazy too. Use AMQPConnectionFactory with AMQPConnectionConfig::setIsLazy(true)
*/
class AMQPLazySSLConnection extends AMQPSSLConnection
{
/**
* @inheritDoc
*/
public function connectOnConstruct(): bool
{
return false;
}
/**
* @param string[][] $hosts
* @param string[] $options
* @return self
* @throws \Exception
* @deprecated Use ConnectionFactory
*/
public static function create_connection($hosts, $options = array())
{
if (count($hosts) > 1) {
throw new \RuntimeException('Lazy connection does not support multiple hosts');
}
return parent::create_connection($hosts, $options);
}
}
<?php
namespace PhpAmqpLib\Connection;
/**
* @deprecated AMQPSocketConnection can be lazy too. Use AMQPConnectionFactory with AMQPConnectionConfig::setIsLazy(true)
*/
class AMQPLazySocketConnection extends AMQPSocketConnection
{
/**
* @inheritDoc
*/
public function connectOnConstruct(): bool
{
return false;
}
/**
* @param string[][] $hosts
* @param string[] $options
* @return self
* @throws \Exception
* @deprecated Use ConnectionFactory
*/
public static function create_connection($hosts, $options = array())
{
if (count($hosts) > 1) {
throw new \RuntimeException('Lazy connection does not support multiple hosts');
}
return parent::create_connection($hosts, $options);
}
}
<?php
namespace PhpAmqpLib\Connection;
class AMQPSSLConnection extends AMQPStreamConnection
{
/**
* @param string $host
* @param int $port
* @param string $user
* @param string $password
* @param string $vhost
* @param array $ssl_options
* @param array $options
* @param string $ssl_protocol
* @param AMQPConnectionConfig|null $config
* @throws \Exception
*/
public function __construct(
$host,
$port,
$user,
$password,
$vhost = '/',
$ssl_options = array(),
$options = array(),
$ssl_protocol = 'ssl',
?AMQPConnectionConfig $config = null
) {
if (empty($ssl_options)) {
trigger_error('Using non-TLS instances of AMQPSSLConnection is deprecated and will be removed in version 4 of php-amqplib', E_USER_DEPRECATED);
$ssl_context = null;
} else {
$ssl_context = $this->createSslContext($ssl_options);
}
parent::__construct(
$host,
$port,
$user,
$password,
$vhost,
isset($options['insist']) ? $options['insist'] : false,
isset($options['login_method']) ? $options['login_method'] : 'AMQPLAIN',
isset($options['login_response']) ? $options['login_response'] : null,
isset($options['locale']) ? $options['locale'] : 'en_US',
isset($options['connection_timeout']) ? $options['connection_timeout'] : 3,
isset($options['read_write_timeout']) ? $options['read_write_timeout'] : 130,
$ssl_context,
isset($options['keepalive']) ? $options['keepalive'] : false,
isset($options['heartbeat']) ? $options['heartbeat'] : 0,
isset($options['channel_rpc_timeout']) ? $options['channel_rpc_timeout'] : 0.0,
$ssl_protocol,
$config
);
}
/**
* @deprecated Use ConnectionFactory
* @throws \Exception
*/
public static function try_create_connection($host, $port, $user, $password, $vhost, $options)
{
$ssl_options = isset($options['ssl_options']) ? $options['ssl_options'] : [];
return new static($host, $port, $user, $password, $vhost, $ssl_options, $options);
}
/**
* @param array $options
* @return resource
*/
private function createSslContext($options)
{
$ssl_context = stream_context_create();
foreach ($options as $k => $v) {
stream_context_set_option($ssl_context, 'ssl', $k, $v);
}
return $ssl_context;
}
}