Skip to content

Commit b73ae37

Browse files
author
Julien Pauli
committed
Fix
1 parent 1f8cd96 commit b73ae37

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

Book/php7/extensions_design/php_functions.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ So now in C, first we must change our ``arg_info``::
615615
616616
*1*, passed in the ``ZEND_ARG_INFO()`` macro tells the engine that argument must be passed by reference.
617617

618-
Then, when we receive the argument, we use the *"z/"* argument type, to tell that we want to be given it as a ``zval *``.
618+
Then, when we receive the argument, we use the *"z"* argument type, to tell that we want to be given it as a ``zval *``.
619619
As we did hint the engine about the fact that it should pass us a reference, we'll be given a reference into that zval,
620620
aka it will be of type ``IS_REFERENCE``. We just need to dereference it (that is to fetch the zval stored into the
621621
zval), and modify it as-is, as the expected behavior of references is that you must modify the value carried by the
@@ -626,7 +626,7 @@ reference::
626626
double result;
627627
zval *param;
628628

629-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/", &param) == FAILURE) {
629+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &param) == FAILURE) {
630630
return;
631631
}
632632

@@ -638,11 +638,4 @@ reference::
638638

639639
Done.
640640

641-
We used *"z/"*. If you read the `zpp readme <https://github.com/php/php-src/blob/
642-
ef4b2fc283ddaf9bd692015f1db6dad52171c3ce/README.PARAMETER_PARSING_API>`_, you'll notice that the *"/"* tells the engine
643-
to separate the value into the zval.
644-
645-
Remember that the zval is just a container, it could carry f.e an array (*zend_array*) and that latter could be shared
646-
elsewhere in the engine which would not expect it to be changed.
647-
648641
.. note:: The default ``return_value`` value is ``NULL``. If we don't touch it, the function will return PHP's ``NULL``.

0 commit comments

Comments
 (0)