17

image
Honestly I warn: take this text with a certain amount of skepticism. I just recently started to get acquainted with the internals of PHP, but I would like to tell you about what is happening behind the scenes bug # 75237 .
Papay 20 november 2017, 13:25

 image As a continuation of the research publications of our company on the internal mechanisms of the world's largest messengers. Today we will look at WhatsApp in its current state. In fact, the insides have not changed much over the past three years, the changes there are rather cosmetic.

In this article we will look in detail how to study the protocol of the messenger, answer the question "Can WhatsApp read our correspondence?" And I will attach all the necessary code in PHP.
xially 7 november 2017, 14:48

Recently, the Avito PHP projects have moved to the version of PHP 7.1. On this occasion, we decided to recall how the transition to PHP 7.0 took place for us and our colleagues from OLX. It's a long time ago, but there are beautiful graphics that you want to show the world.
The first part of the story is based on the article PHP's not dead! PHP7 in practice , written by our colleague from OLX Łukasz Szymański (Lukasz Szymanski): the transition of OLX to PHP 7. In the second part - the Avito transition experience in PHP 7.0 and PHP 7.1: the process, the difficulties, the results with the graphs.

image
Tags: Avito, OLX, Php, php7
Papay 18 october 2017, 10:30

image
These are the principles of software development, taken from the Robert Martin Clean Code book and adapted for PHP. This manual is not a programming style, but to create a readable, reusable and refactoring-friendly PHP code.
Not each of these principles should be strictly observed, and with even fewer will all agree. These are just recommendations, not more, but they are all codified in the author's many years of collective experience.
The article is inspired by clean-code-javascript .
KlauS 7 october 2017, 10:27

Hello, UMumble! Once, I was faced with a choice in the process of developing an authentication system for my project. Namely, what is the best way to store user passwords in the database? Many options came into my head. The most obvious were:

1. Storing the passwords as a plain text in a database.
2. Using regular hashes, such as crc32, md5, and sha1.
3. Using crypt() function.
4. Using the statical salt as type of structure md5(md5($ pass)).
5. Using the unique salt for each user.

The first and second options I had to eliminate for several reasons right away.
Pirat 4 may 2012, 20:45

imageIt was nice to find the website of this framework quite randomly in the second half of the business hours. New frameworks are rare, and even more rarely you come across mechanisms that are liked at first sight. Therefore, I would like to share my discovery with you.

First, I liked its name Nette right away. It's almost like a Latte. Only Nette as it turned out later is the Latte that has its own built-in template engine. Oh.

Second, at first view it created an impression of something new and advanced (they are almost as thoughts of the PHP team, pluging in the genius language the traits, and forgetting the boring Unicode):
  • HTML5
  • PHP 5.3
  • Built-in HTML template macros
  • Context-Aware Escaping technology
  • Configurations in the curious NEON format, on basis of which is generated PHP code
  • Own implementation of the base class for objects Nette \ Object
  • Events and subscription
  • Callbacks
  • New streaming protocol safe :/ / for an atomic access to the file system
ZimerMan 10 march 2012, 14:48

Here is a memo for novice exorcist:)

Before I begin, I know what are phpDaemon and System_Daemon. I read some articles about this subject.

So, let's assume that you've already decided that you need the daemon. What should daemon be able to do?

• It should run from the console and unbind from it.
• It should write all information to the logs, nothing output to the console.
• It should be able to create the child processes and monitor them.
• It should perform an assigned task.
• It should correctly complete a job.
Tags: daemon, Php
ZimerMan 20 february 2012, 16:34

imageThere is a widespread view that the ordinary PHP developer does not need to control memory management, but "controlling" and "knowing" are slightly different concepts. I will try to throw light upon some aspects of memory management when working with variables and arrays, and some interesting pitfalls of the internal optimization of PHP. As you can see, the optimization is good, but if you do not know exactly how it is optimized, you might meet the pitfalls, which can make you pretty nervous.

Overview


Learning the basics

In PHP a variable consists of two parts: "name" that is stored in hash_table, symbol_table and "value" that is stored in zval container.
This method allows creating multiple variables that are referring to one value, which in some cases allows optimizing the memory usage. How it looks in practice will be written further.

The most common code elements without which it is difficult to imagine a functional script are the following things:
- Creation, assignment and removal of variables (numbers, strings, etc.).
- Creation of arrays and their bypass (as an example will be used the function foreach).
- Passing and return values for functions / methods.
BumBum 9 february 2012, 14:16

In the Web you can find a lot of solutions to emulate multithreading in php. Most often they are based on the forks, but there are variations about using curl, proc_open and etc.

I did not like the alternatives that I found, so I had to write my own solution.
Here is the following set of requirements:

• Use of the forks
• In-sync state with the interface in the absence of the necessary extensions
• Multiple use of child processes
• A full data exchange between processes. That is, running with the arguments and getting results at the end
• The event exchange between the child process-"thread" and the basic process at work
• Handling the thread pool with the multiple use, transferring arguments and getting results
• Error handling
• Timeouts for the work performance, waiting for work thread, initialization
• Maximum performance

The result is a CThread library.

Here is a link to the sources:
github.com/amal/CThread
xially 7 february 2012, 13:10

After I have read some article about the handling of critical errors in PHP, I noticed that the error codes were customized specially for the bitwise operations in PHP, however, in the article’s examples and the comments are used regular operators for comparison in order to check the error codes.

For example, there were such variations:

if ($error['type'] == E_ERROR || $error['type'] == E_PARSE || $error['type'] == E_COMPILE_ERROR){…}
or

if(in_array($error['type'], array(E_ERROR, E_PARSE, E_COMPILE_ERROR)) {…}
Thereby, I decided to write a short article about the bitwise operations with examples of their use.
BumBum 2 february 2012, 21:20
1 2