Skip to content

Commit 131cca5

Browse files
committed
Consistent opcache casing
1 parent 25acbe7 commit 131cca5

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

Book/php5/build_system/building_extensions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ everything else. The reason is simply that building external extensions as share
5151
intrusive), as you will see in a moment. Another benefit is that you can update the extension without rebuilding PHP.
5252

5353
.. [#] We'll explain the difference between a "normal" extension and a Zend extension later in the book. For now it
54-
suffices to know that Zend extensions are more "low level" (e.g. opcache or xdebug) and hook into the workings of
54+
suffices to know that Zend extensions are more "low level" (e.g. opcache or Xdebug) and hook into the workings of
5555
the Zend Engine itself.
5656
5757
Installing extensions from PECL

Book/php7/extensions_design/hooks.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Modifying the Abstract Syntax Tree (AST)
123123
****************************************
124124

125125
When PHP 7 compiles PHP code it converts it into an abstract syntax tree (AST)
126-
before finally generating Opcodes that are persisted in Opcache. The
126+
before finally generating opcodes that are persisted in opcache. The
127127
``zend_ast_process hook`` is called for every compiled script and allows you to
128128
modify the AST after it is parsed and created.
129129

@@ -170,10 +170,10 @@ and all PHP scripts compiled after the replacement will be handled by your
170170
implementation of the hook.
171171

172172
It is very important to always call the original function pointer, otherwise
173-
PHP cannot compile scripts anymore and Opcache will not work anymore.
173+
PHP cannot compile scripts anymore and opcache will not work anymore.
174174

175175
The extension overwriting order here is also important as you need to be aware
176-
whether you want to register your hook before or after Opcache, because Opcache
176+
whether you want to register your hook before or after opcache, because opcache
177177
does not call the original function pointer if it finds an opcode array entry
178178
in its shared memory cache. Opcache registers their hook as a post startup
179179
hook, which runs after the minit phase for extensions, so by default your hook

Book/php7/extensions_design/zend_extensions.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Why need a Zend extension ?
103103
Let us warn you : until you have **very advanced** knowledge on PHP internal's Vritual Machine, and until you need to
104104
hook deep into it, you shouldn't need a Zend extension, but a PHP extension will be enough.
105105

106-
Today's most commonly known Zend extensions into PHP's world are OPCache, XDebug, phpdbg and Blackfire. But you know
106+
Today's most commonly known Zend extensions into PHP's world are opcache, Xdebug, phpdbg and Blackfire. But you know
107107
dozens of PHP extensions next to that don't you ?! That's a clear sign that :
108108

109109
* You should not need a Zend extension for a very big part of your problematics
@@ -215,7 +215,7 @@ In *practice*, what we can say about it is that :
215215
Until some distributions (FreeBSD hear us) change that ...
216216

217217
* Zend extensions are triggered **before** PHP extensions when a request shows in. That means they got a chance to modify
218-
the engine about the current request to come, so that PHP extensions use that modified context. OPCache uses such a
218+
the engine about the current request to come, so that PHP extensions use that modified context. Opcache uses such a
219219
trick so that it can perform its complex tasks before any extension had a chance to prevent it to.
220220

221221
* Same for request shutdown : Zend extensions can assume every PHP extension has shut down the request.
@@ -301,7 +301,7 @@ That's all for now. Let's fill-in those empty-body functions now::
301301

302302
Like said before, ``message_handler()`` is a special hook that Zend extensions may declare to be noticed when another
303303
Zend extension get loaded. But be careful of the order. You must register our "pib" Zend extension first, then
304-
another Zend extension (like OPCache) after that, as the ``message_handler()`` is only called when a Zend extension is
304+
another Zend extension (like opcache) after that, as the ``message_handler()`` is only called when a Zend extension is
305305
loaded you obviously need to be loaded before to declare it. Chicken and egg.
306306

307307
Then we'll start to dive into the engine, with our ``op_array_handler`` hook::
@@ -479,10 +479,10 @@ How is that possible ? And what for ?.
479479
Well there are several answers to such a question :
480480

481481
* To :doc:`register new PHP functions <php_functions>`, a PHP extension is better than a Zend extension, as it already
482-
knows how to do and has been designed for that specific purpose first. That would be pity not to use it. OPCache
482+
knows how to do and has been designed for that specific purpose first. That would be pity not to use it. Opcache
483483
does that.
484484
* If you need to register about all the hooks in the full lifecycle, you'll obviously need both sides
485-
* If you need to master the order Zend extensions are loaded, f.e to get loaded after OPCache, you will need to be
485+
* If you need to master the order Zend extensions are loaded, f.e to get loaded after opcache, you will need to be
486486
hybrid
487487

488488
The trick is simple, choose between :
@@ -656,7 +656,7 @@ Our PHP extension is effectively called "pib" and shows up, and our Zend extensi
656656
"pib-zend-extension" and shows up as well. We chose two different names for both parts, we could have chosen the same
657657
name.
658658

659-
.. note:: OPCache and Xdebug use such an hybrid model, they are Zend extensions, but they need to publish PHP
659+
.. note:: Opcache and Xdebug use such an hybrid model, they are Zend extensions, but they need to publish PHP
660660
functions and thus they are also PHP extensions to do so.
661661

662662
Hybrid PHP extension master, Zend extension slave

Book/php7/internal_types/strings/zend_strings.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ Interned strings
250250
----------------
251251

252252
Just a quick word here about `interned strings <https://en.wikipedia.org/wiki/String_interning>`_. You could
253-
need such a concept in extension development. Interned strings also interact with OPCache extension.
253+
need such a concept in extension development. Interned strings also interact with opcache extension.
254254

255-
Interned strings are deduplicated strings. When used with OPCache, they also get reused from request to request.
255+
Interned strings are deduplicated strings. When used with opcache, they also get reused from request to request.
256256

257257
Say you want to create the string "foo". What you tend to do is simply create a new string "foo"::
258258

@@ -322,25 +322,25 @@ This process is in fact a little bit more complex than this. If you make use of
322322
:doc:`request processing <../../extensions_design/php_lifecycle>`, that string will be interned for sure.
323323
However, if you make use of an interned string as PHP is treating a request, then this string will only get interned for
324324
the current request, and will get cleared after that.
325-
All this is valid if you don't use the OPCache extension, something you shouldn't do : use it.
325+
All this is valid if you don't use the opcache extension, something you shouldn't do : use it.
326326

327-
When using the OPCache extension, if you make use of an interned string out of a
327+
When using the opcache extension, if you make use of an interned string out of a
328328
:doc:`request processing <../../extensions_design/php_lifecycle>`, that string will be
329329
interned for sure and will also be shared to every PHP process or thread that will be spawned by you parallelism layer.
330-
Also, if you make use of an interned string as PHP is treating a request, this string will also get interned by OPCache
330+
Also, if you make use of an interned string as PHP is treating a request, this string will also get interned by opcache
331331
itself, and shared to every PHP process or thread that will be spawned by you parallelism layer.
332332

333-
Interned strings mechanisms are then changed when OPCache extension fires in. OPCache not only allows to intern strings
333+
Interned strings mechanisms are then changed when opcache extension fires in. Opcache not only allows to intern strings
334334
that come from a request, but it also allows to share them to every PHP process of the same pool. This is done using
335-
shared memory. When saving an interned string, OPCache will also add the ``IS_STR_PERMANENT`` flag to its GC info.
335+
shared memory. When saving an interned string, opcache will also add the ``IS_STR_PERMANENT`` flag to its GC info.
336336
That flag means the memory allocation used for the structure (``zend_string`` here) is permanent, it could be a shared
337337
read-only memory segment.
338338

339339
Interned strings save memory, because the same string is never stored more than once in memory. But it could waste some
340340
CPU time as it often needs to lookup the interned strings store, even if that process is well optimized yet.
341341
As an extension designer, here are global rules:
342342

343-
* If OPCache is used (it should be), and if you need to create read-only strings : use an interned string.
343+
* If opcache is used (it should be), and if you need to create read-only strings : use an interned string.
344344
* If you need a string you know for sure PHP will have interned (a well-known-PHP-string, f.e "php" or "str_replace"),
345345
use an interned string.
346346
* If the string is not read-only and could/should be altered after its been created, do not use an interned string.

Book/php7/zend_engine.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Zend engine
33

44
The Zend engine is a set of components that make PHP what it is. The most important Zend engine component is the
55
*Zend Virtual Machine*, which is composed of the *Zend Compiler* and the *Zend Executor* components. We could also add
6-
the OPCache zend extension in such category. Those three components are the heart of PHP (or the brain, you choose),
6+
the opcache zend extension in such category. Those three components are the heart of PHP (or the brain, you choose),
77
they are critical and they are the most complex parts of all the PHP source code. In the current chapter, we'll try to
88
open them and detail them.
99

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Zend OPCache
1+
Zend opcache
22
============

0 commit comments

Comments
 (0)