php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
password.c
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Authors: Anthony Ferrara <ircmaxell@php.net> |
14 | Charles R. Portwood II <charlesportwoodii@erianna.com> |
15 +----------------------------------------------------------------------+
16*/
17
18#include <stdlib.h>
19
20#include "php.h"
21
22#include "fcntl.h"
23#include "php_password.h"
24#include "php_crypt.h"
25#include "base64.h"
26#include "zend_interfaces.h"
27#include "info.h"
29#include "password_arginfo.h"
30#ifdef HAVE_ARGON2LIB
31#include "argon2.h"
32#endif
33
34#ifdef PHP_WIN32
35#include "win32/winutil.h"
36#endif
37
38static zend_array php_password_algos;
39
40int php_password_algo_register(const char *ident, const php_password_algo *algo) {
42 return zend_hash_add_ptr(&php_password_algos, key, (void *) algo) ? SUCCESS : FAILURE;
43}
44
45void php_password_algo_unregister(const char *ident) {
46 zend_hash_str_del(&php_password_algos, ident, strlen(ident));
47}
48
49static int php_password_salt_to64(const char *str, const size_t str_len, const size_t out_len, char *ret) /* {{{ */
50{
51 size_t pos = 0;
53 if ((int) str_len < 0) {
54 return FAILURE;
55 }
56 buffer = php_base64_encode((unsigned char*) str, str_len);
57 if (ZSTR_LEN(buffer) < out_len) {
58 /* Too short of an encoded string generated */
60 return FAILURE;
61 }
62 for (pos = 0; pos < out_len; pos++) {
63 if (ZSTR_VAL(buffer)[pos] == '+') {
64 ret[pos] = '.';
65 } else if (ZSTR_VAL(buffer)[pos] == '=') {
66 zend_string_free(buffer);
67 return FAILURE;
68 } else {
70 }
71 }
72 zend_string_free(buffer);
73 return SUCCESS;
74}
75/* }}} */
76
77static zend_string* php_password_make_salt(size_t length) /* {{{ */
78{
80
81 if (length > (INT_MAX / 3)) {
82 zend_value_error("Length is too large to safely generate");
83 return NULL;
84 }
85
86 buffer = zend_string_alloc(length * 3 / 4 + 1, 0);
87 if (FAILURE == php_random_bytes_throw(ZSTR_VAL(buffer), ZSTR_LEN(buffer))) {
88 zend_value_error("Unable to generate salt");
90 return NULL;
91 }
92
93 ret = zend_string_alloc(length, 0);
94 if (php_password_salt_to64(ZSTR_VAL(buffer), ZSTR_LEN(buffer), length, ZSTR_VAL(ret)) == FAILURE) {
95 zend_value_error("Generated salt too short");
98 return NULL;
99 }
101 ZSTR_VAL(ret)[length] = 0;
102 return ret;
103}
104/* }}} */
105
106static zend_string* php_password_get_salt(zval *unused_, size_t required_salt_len, HashTable *options) {
107 if (options && zend_hash_str_exists(options, "salt", sizeof("salt") - 1)) {
108 php_error_docref(NULL, E_WARNING, "The \"salt\" option has been ignored, since providing a custom salt is no longer supported");
109 }
110
111 return php_password_make_salt(required_salt_len);
112}
113
114/* bcrypt implementation */
115
116static bool php_password_bcrypt_valid(const zend_string *hash) {
117 const char *h = ZSTR_VAL(hash);
118 return (ZSTR_LEN(hash) == 60) &&
119 (h[0] == '$') && (h[1] == '2') && (h[2] == 'y');
120}
121
122static int php_password_bcrypt_get_info(zval *return_value, const zend_string *hash) {
124
125 if (!php_password_bcrypt_valid(hash)) {
126 /* Should never get called this way. */
127 return FAILURE;
128 }
129
130 sscanf(ZSTR_VAL(hash), "$2y$" ZEND_LONG_FMT "$", &cost);
131 add_assoc_long(return_value, "cost", cost);
132
133 return SUCCESS;
134}
135
136static bool php_password_bcrypt_needs_rehash(const zend_string *hash, zend_array *options) {
137 zval *znew_cost;
140
141 if (!php_password_bcrypt_valid(hash)) {
142 /* Should never get called this way. */
143 return 1;
144 }
145
146 sscanf(ZSTR_VAL(hash), "$2y$" ZEND_LONG_FMT "$", &old_cost);
147 if (options && (znew_cost = zend_hash_str_find(options, "cost", sizeof("cost")-1)) != NULL) {
148 new_cost = zval_get_long(znew_cost);
149 }
150
151 return old_cost != new_cost;
152}
153
154static bool php_password_bcrypt_verify(const zend_string *password, const zend_string *hash) {
155 int status = 0;
156 zend_string *ret = php_crypt(ZSTR_VAL(password), (int)ZSTR_LEN(password), ZSTR_VAL(hash), (int)ZSTR_LEN(hash), 1);
157
158 if (!ret) {
159 return 0;
160 }
161
162 if (ZSTR_LEN(hash) < 13) {
163 zend_string_free(ret);
164 return 0;
165 }
166
167 /* We're using this method instead of == in order to provide
168 * resistance towards timing attacks. This is a constant time
169 * equality check that will always check every byte of both
170 * values. */
172
173 zend_string_free(ret);
174 return status == 0;
175}
176
177static zend_string* php_password_bcrypt_hash(const zend_string *password, zend_array *options) {
178 char hash_format[10];
179 size_t hash_format_len;
180 zend_string *result, *hash, *salt;
181 zval *zcost;
183
184 if (memchr(ZSTR_VAL(password), '\0', ZSTR_LEN(password))) {
185 zend_value_error("Bcrypt password must not contain null character");
186 return NULL;
187 }
188
189 if (options && (zcost = zend_hash_str_find(options, "cost", sizeof("cost")-1)) != NULL) {
190 cost = zval_get_long(zcost);
191 }
192
193 if (cost < 4 || cost > 31) {
194 zend_value_error("Invalid bcrypt cost parameter specified: " ZEND_LONG_FMT, cost);
195 return NULL;
196 }
197
198 hash_format_len = snprintf(hash_format, sizeof(hash_format), "$2y$%02" ZEND_LONG_FMT_SPEC "$", cost);
199 if (!(salt = php_password_get_salt(NULL, Z_UL(22), options))) {
200 return NULL;
201 }
202 ZSTR_VAL(salt)[ZSTR_LEN(salt)] = 0;
203
204 hash = zend_string_concat2(hash_format, hash_format_len, ZSTR_VAL(salt), ZSTR_LEN(salt));
205
206 zend_string_release_ex(salt, 0);
207
208 /* This cast is safe, since both values are defined here in code and cannot overflow */
209 result = php_crypt(ZSTR_VAL(password), (int)ZSTR_LEN(password), ZSTR_VAL(hash), (int)ZSTR_LEN(hash), 1);
211
212 if (!result) {
213 return NULL;
214 }
215
216 if (ZSTR_LEN(result) < 13) {
217 zend_string_free(result);
218 return NULL;
219 }
220
221 return result;
222}
223
225 "bcrypt",
226 php_password_bcrypt_hash,
227 php_password_bcrypt_verify,
228 php_password_bcrypt_needs_rehash,
229 php_password_bcrypt_get_info,
230 php_password_bcrypt_valid,
231};
232
233
234#ifdef HAVE_ARGON2LIB
235/* argon2i/argon2id shared implementation */
236
237static int extract_argon2_parameters(const zend_string *hash,
238 zend_long *v, zend_long *memory_cost,
239 zend_long *time_cost, zend_long *threads) /* {{{ */
240{
241 const char *p = ZSTR_VAL(hash);
242 if (!hash || (ZSTR_LEN(hash) < sizeof("$argon2id$"))) {
243 return FAILURE;
244 }
245 if (!memcmp(p, "$argon2i$", sizeof("$argon2i$") - 1)) {
246 p += sizeof("$argon2i$") - 1;
247 } else if (!memcmp(p, "$argon2id$", sizeof("$argon2id$") - 1)) {
248 p += sizeof("$argon2id$") - 1;
249 } else {
250 return FAILURE;
251 }
252
254 v, memory_cost, time_cost, threads);
255
256 return SUCCESS;
257}
258/* }}} */
259
260static int php_password_argon2_get_info(zval *return_value, const zend_string *hash) {
261 zend_long v = 0;
262 zend_long memory_cost = PHP_PASSWORD_ARGON2_MEMORY_COST;
263 zend_long time_cost = PHP_PASSWORD_ARGON2_TIME_COST;
264 zend_long threads = PHP_PASSWORD_ARGON2_THREADS;
265
266 extract_argon2_parameters(hash, &v, &memory_cost, &time_cost, &threads);
267
268 add_assoc_long(return_value, "memory_cost", memory_cost);
269 add_assoc_long(return_value, "time_cost", time_cost);
270 add_assoc_long(return_value, "threads", threads);
271
272 return SUCCESS;
273}
274
275static bool php_password_argon2_needs_rehash(const zend_string *hash, zend_array *options) {
276 zend_long v = 0;
277 zend_long new_memory_cost = PHP_PASSWORD_ARGON2_MEMORY_COST, memory_cost = 0;
278 zend_long new_time_cost = PHP_PASSWORD_ARGON2_TIME_COST, time_cost = 0;
279 zend_long new_threads = PHP_PASSWORD_ARGON2_THREADS, threads = 0;
280 zval *option_buffer;
281
282 if (options && (option_buffer = zend_hash_str_find(options, "memory_cost", sizeof("memory_cost")-1)) != NULL) {
283 new_memory_cost = zval_get_long(option_buffer);
284 }
285
286 if (options && (option_buffer = zend_hash_str_find(options, "time_cost", sizeof("time_cost")-1)) != NULL) {
287 new_time_cost = zval_get_long(option_buffer);
288 }
289
290 if (options && (option_buffer = zend_hash_str_find(options, "threads", sizeof("threads")-1)) != NULL) {
291 new_threads = zval_get_long(option_buffer);
292 }
293
294 extract_argon2_parameters(hash, &v, &memory_cost, &time_cost, &threads);
295
296 return (new_time_cost != time_cost) ||
297 (new_memory_cost != memory_cost) ||
298 (new_threads != threads);
299}
300
301static zend_string *php_password_argon2_hash(const zend_string *password, zend_array *options, argon2_type type) {
302 zval *option_buffer;
303 zend_string *salt, *out, *encoded;
304 size_t time_cost = PHP_PASSWORD_ARGON2_TIME_COST;
305 size_t memory_cost = PHP_PASSWORD_ARGON2_MEMORY_COST;
306 size_t threads = PHP_PASSWORD_ARGON2_THREADS;
307 size_t encoded_len;
308 int status = 0;
309
310 if (options && (option_buffer = zend_hash_str_find(options, "memory_cost", sizeof("memory_cost")-1)) != NULL) {
311 memory_cost = zval_get_long(option_buffer);
312 }
313
314 if (memory_cost > ARGON2_MAX_MEMORY || memory_cost < ARGON2_MIN_MEMORY) {
315 zend_value_error("Memory cost is outside of allowed memory range");
316 return NULL;
317 }
318
319 if (options && (option_buffer = zend_hash_str_find(options, "time_cost", sizeof("time_cost")-1)) != NULL) {
320 time_cost = zval_get_long(option_buffer);
321 }
322
323 if (time_cost > ARGON2_MAX_TIME || time_cost < ARGON2_MIN_TIME) {
324 zend_value_error("Time cost is outside of allowed time range");
325 return NULL;
326 }
327
328 if (options && (option_buffer = zend_hash_str_find(options, "threads", sizeof("threads")-1)) != NULL) {
329 threads = zval_get_long(option_buffer);
330 }
331
332 if (threads > ARGON2_MAX_LANES || threads == 0) {
333 zend_value_error("Invalid number of threads");
334 return NULL;
335 }
336
337 if (!(salt = php_password_get_salt(NULL, Z_UL(16), options))) {
338 return NULL;
339 }
340
341 out = zend_string_alloc(32, 0);
342 encoded_len = argon2_encodedlen(
343 time_cost,
344 memory_cost,
345 threads,
346 (uint32_t)ZSTR_LEN(salt),
347 ZSTR_LEN(out),
348 type
349 );
350
351 encoded = zend_string_alloc(encoded_len - 1, 0);
352 status = argon2_hash(
353 time_cost,
354 memory_cost,
355 threads,
356 ZSTR_VAL(password),
357 ZSTR_LEN(password),
358 ZSTR_VAL(salt),
359 ZSTR_LEN(salt),
360 ZSTR_VAL(out),
361 ZSTR_LEN(out),
362 ZSTR_VAL(encoded),
363 encoded_len,
364 type,
365 ARGON2_VERSION_NUMBER
366 );
367
369 zend_string_release_ex(salt, 0);
370
371 if (status != ARGON2_OK) {
372 zend_string_efree(encoded);
373 zend_value_error("%s", argon2_error_message(status));
374 return NULL;
375 }
376
377 ZSTR_VAL(encoded)[ZSTR_LEN(encoded)] = 0;
378 return encoded;
379}
380
381/* argon2i specific methods */
382
383static bool php_password_argon2i_verify(const zend_string *password, const zend_string *hash) {
384 return ARGON2_OK == argon2_verify(ZSTR_VAL(hash), ZSTR_VAL(password), ZSTR_LEN(password), Argon2_i);
385}
386
387static zend_string *php_password_argon2i_hash(const zend_string *password, zend_array *options) {
388 return php_password_argon2_hash(password, options, Argon2_i);
389}
390
391const php_password_algo php_password_algo_argon2i = {
392 "argon2i",
393 php_password_argon2i_hash,
394 php_password_argon2i_verify,
395 php_password_argon2_needs_rehash,
396 php_password_argon2_get_info,
397 NULL,
398};
399
400/* argon2id specific methods */
401
402static bool php_password_argon2id_verify(const zend_string *password, const zend_string *hash) {
403 return ARGON2_OK == argon2_verify(ZSTR_VAL(hash), ZSTR_VAL(password), ZSTR_LEN(password), Argon2_id);
404}
405
406static zend_string *php_password_argon2id_hash(const zend_string *password, zend_array *options) {
407 return php_password_argon2_hash(password, options, Argon2_id);
408}
409
410const php_password_algo php_password_algo_argon2id = {
411 "argon2id",
412 php_password_argon2id_hash,
413 php_password_argon2id_verify,
414 php_password_argon2_needs_rehash,
415 php_password_argon2_get_info,
416 NULL,
417};
418#endif
419
420PHP_MINIT_FUNCTION(password) /* {{{ */
421{
422 zend_hash_init(&php_password_algos, 4, NULL, ZVAL_PTR_DTOR, 1);
423
425
429
430#ifdef HAVE_ARGON2LIB
431 if (FAILURE == php_password_algo_register("argon2i", &php_password_algo_argon2i)) {
432 return FAILURE;
433 }
434 if (FAILURE == php_password_algo_register("argon2id", &php_password_algo_argon2id)) {
435 return FAILURE;
436 }
437#endif
438
439 return SUCCESS;
440}
441/* }}} */
442
443PHP_MSHUTDOWN_FUNCTION(password) /* {{{ */
444{
445#ifdef ZTS
446 if (!tsrm_is_main_thread()) {
447 return SUCCESS;
448 }
449#endif
450 zend_hash_destroy(&php_password_algos);
451 return SUCCESS;
452}
453/* }}} */
454
458
460 zval *tmp;
461
462 if (!ident) {
463 return NULL;
464 }
465
466 tmp = zend_hash_find(&php_password_algos, (zend_string*)ident);
467 if (!tmp || (Z_TYPE_P(tmp) != IS_PTR)) {
468 return NULL;
469 }
470
471 return Z_PTR_P(tmp);
472}
473
474static const php_password_algo* php_password_algo_find_zval(zend_string *arg_str, zend_long arg_long, bool arg_is_null) {
475 if (arg_is_null) {
477 }
478
479 if (arg_str) {
480 return php_password_algo_find(arg_str);
481 }
482
483 switch (arg_long) {
484 case 0: return php_password_algo_default();
485 case 1: return &php_password_algo_bcrypt;
486#ifdef HAVE_ARGON2LIB
487 case 2: return &php_password_algo_argon2i;
488 case 3: return &php_password_algo_argon2id;
489#else
490 case 2:
491 {
492 zend_string *n = ZSTR_INIT_LITERAL("argon2i", 0);
494 zend_string_release(n);
495 return ret;
496 }
497 case 3:
498 {
499 zend_string *n = ZSTR_INIT_LITERAL("argon2id", 0);
501 zend_string_release(n);
502 return ret;
503 }
504#endif
505 }
506
507 return NULL;
508}
509
511 const char *ident, *ident_end;
512
513 if (!hash || ZSTR_LEN(hash) < 3) {
514 /* Minimum prefix: "$x$" */
515 return NULL;
516 }
517
518 ident = ZSTR_VAL(hash) + 1;
519 ident_end = strchr(ident, '$');
520 if (!ident_end) {
521 /* No terminating '$' */
522 return NULL;
523 }
524
525 return zend_string_init(ident, ident_end - ident, 0);
526}
527
529 const php_password_algo *algo;
531
532 if (!ident) {
533 return default_algo;
534 }
535
536 algo = php_password_algo_find(ident);
537 zend_string_release(ident);
538 return (!algo || (algo->valid && !algo->valid(hash))) ? default_algo : algo;
539}
540
541/* {{{ Retrieves information about a given hash */
543{
544 const php_password_algo *algo;
545 zend_string *hash, *ident;
547
551
554
556 algo = php_password_algo_find(ident);
557 if (!algo || (algo->valid && !algo->valid(hash))) {
558 if (ident) {
559 zend_string_release(ident);
560 }
561 add_assoc_null(return_value, "algo");
562 add_assoc_string(return_value, "algoName", "unknown");
563 add_assoc_zval(return_value, "options", &options);
564 return;
565 }
566
567 add_assoc_str(return_value, "algo", php_password_algo_extract_ident(hash));
568 zend_string_release(ident);
569
570 add_assoc_string(return_value, "algoName", algo->name);
571 if (algo->get_info) {
572 algo->get_info(&options, hash);
573 }
574 add_assoc_zval(return_value, "options", &options);
575}
576
577
578/* {{{ Determines if a given hash requires re-hashing based upon parameters */
580{
581 const php_password_algo *old_algo, *new_algo;
583 zend_string *new_algo_str;
584 zend_long new_algo_long = 0;
585 bool new_algo_is_null;
587
590 Z_PARAM_STR_OR_LONG_OR_NULL(new_algo_str, new_algo_long, new_algo_is_null)
594
595 new_algo = php_password_algo_find_zval(new_algo_str, new_algo_long, new_algo_is_null);
596 if (!new_algo) {
597 /* Unknown new algorithm, never prompt to rehash. */
599 }
600
602 if (old_algo != new_algo) {
603 /* Different algorithm preferred, always rehash. */
605 }
606
608}
609/* }}} */
610
611/* {{{ Verify a hash created using crypt() or password_hash() */
613{
614 zend_string *password, *hash;
615 const php_password_algo *algo;
616
618 Z_PARAM_STR(password)
621
622 algo = php_password_algo_identify(hash);
623 RETURN_BOOL(algo && (!algo->verify || algo->verify(password, hash)));
624}
625/* }}} */
626
627/* {{{ Hash a password */
629{
630 zend_string *password, *digest = NULL;
631 zend_string *algo_str;
632 zend_long algo_long = 0;
633 bool algo_is_null;
634 const php_password_algo *algo;
636
638 Z_PARAM_STR(password)
639 Z_PARAM_STR_OR_LONG_OR_NULL(algo_str, algo_long, algo_is_null)
643
644 algo = php_password_algo_find_zval(algo_str, algo_long, algo_is_null);
645 if (!algo) {
646 zend_argument_value_error(2, "must be a valid password hashing algorithm");
648 }
649
650 digest = algo->hash(password, options);
651 if (!digest) {
652 if (!EG(exception)) {
653 zend_throw_error(NULL, "Password hashing failed for unknown reason");
654 }
656 }
657
658 RETURN_NEW_STR(digest);
659}
660/* }}} */
661
662/* {{{ */
664 zend_string *algo;
665
667
669 ZEND_HASH_MAP_FOREACH_STR_KEY(&php_password_algos, algo) {
670 add_next_index_str(return_value, zend_string_copy(algo));
672}
673/* }}} */
bool exception
Definition assert.c:30
password_verify(#[\SensitiveParameter] string $password, string $hash)
password_get_info(string $hash)
sscanf(string $string, string $format, mixed &... $vars)
password_needs_rehash(string $hash, string|int|null $algo, array $options=[])
strchr(string $haystack, string $needle, bool $before_needle=false)
password_hash(#[\SensitiveParameter] string $password, string|int|null $algo, array $options=[])
uint32_t v
Definition cdf.c:1237
PHPAPI zend_string * php_crypt(const char *password, const int pass_len, const char *salt, int salt_len, bool quiet)
Definition crypt.c:70
DNS_STATUS status
Definition dns_win32.c:49
zend_ffi_type * type
Definition ffi.c:3812
zend_long n
Definition ffi.c:4979
#define NULL
Definition gdcache.h:45
hash(string $algo, string $data, bool $binary=false, array $options=[])
Definition hash.stub.php:12
#define SUCCESS
Definition hash_sha3.c:261
PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format,...)
Definition main.c:1173
zend_string * php_password_algo_extract_ident(const zend_string *hash)
Definition password.c:510
register_password_symbols(module_number)
void php_password_algo_unregister(const char *ident)
Definition password.c:45
const php_password_algo * php_password_algo_find(const zend_string *ident)
Definition password.c:459
const php_password_algo * php_password_algo_identify_ex(const zend_string *hash, const php_password_algo *default_algo)
Definition password.c:528
int php_password_algo_register(const char *ident, const php_password_algo *algo)
Definition password.c:40
const php_password_algo * php_password_algo_default(void)
Definition password.c:455
const php_password_algo php_password_algo_bcrypt
Definition password.c:224
#define PHP_FUNCTION
Definition php.h:364
#define PHP_MSHUTDOWN_FUNCTION
Definition php.h:401
#define PHP_MINIT_FUNCTION
Definition php.h:400
#define INT_MAX
Definition php.h:237
PHPAPI int php_safe_bcmp(const zend_string *a, const zend_string *b)
Definition safe_bcmp.c:26
unsigned const char * pos
Definition php_ffi.h:52
PHP_JSON_API size_t int options
Definition php_json.h:102
#define PHP_PASSWORD_BCRYPT_COST
struct _php_password_algo php_password_algo
unsigned char key[REFLECTION_KEY_LEN]
p
Definition session.c:1105
bool(* valid)(const zend_string *hash)
int(* get_info)(zval *return_value, const zend_string *hash)
zend_string *(* hash)(const zend_string *password, zend_array *options)
bool(* needs_rehash)(const zend_string *password, zend_array *options)
const char * name
bool(* verify)(const zend_string *password, const zend_string *hash)
Definition file.h:177
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format,...)
Definition zend.c:1772
ZEND_API ZEND_COLD void zend_value_error(const char *format,...)
Definition zend.c:1849
ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *format,...)
Definition zend_API.c:433
ZEND_API zend_result add_next_index_str(zval *arg, zend_string *str)
Definition zend_API.c:2177
#define ZEND_PARSE_PARAMETERS_END()
Definition zend_API.h:1641
#define RETURN_FALSE
Definition zend_API.h:1058
#define ZEND_PARSE_PARAMETERS_NONE()
Definition zend_API.h:1623
#define Z_PARAM_OPTIONAL
Definition zend_API.h:1667
#define Z_PARAM_STR(dest)
Definition zend_API.h:2086
#define Z_PARAM_STR_OR_LONG_OR_NULL(dest_str, dest_long, is_null)
Definition zend_API.h:2168
#define ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_args)
Definition zend_API.h:1620
#define RETURN_BOOL(b)
Definition zend_API.h:1035
#define RETURN_NEW_STR(s)
Definition zend_API.h:1041
#define RETURN_THROWS()
Definition zend_API.h:1060
#define Z_PARAM_ARRAY_HT(dest)
Definition zend_API.h:1852
#define RETURN_TRUE
Definition zend_API.h:1059
#define array_init(arg)
Definition zend_API.h:537
struct _zval_struct zval
strlen(string $string)
zend_string_release_ex(func->internal_function.function_name, 0)
#define snprintf
#define E_WARNING
Definition zend_errors.h:24
#define EG(v)
ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
Definition zend_hash.c:1727
ZEND_API zval *ZEND_FASTCALL zend_hash_str_find(const HashTable *ht, const char *str, size_t len)
Definition zend_hash.c:2689
ZEND_API zend_result ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *str, size_t len)
Definition zend_hash.c:1661
ZEND_API zval *ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key)
Definition zend_hash.c:2668
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent)
Definition zend_hash.h:108
#define ZEND_HASH_MAP_FOREACH_STR_KEY(ht, _key)
Definition zend_hash.h:1346
#define ZEND_HASH_FOREACH_END()
Definition zend_hash.h:1086
int32_t zend_long
Definition zend_long.h:42
#define ZEND_LONG_FMT_SPEC
Definition zend_long.h:90
#define ZEND_LONG_FMT
Definition zend_long.h:87
#define Z_UL(i)
Definition zend_long.h:49
struct _zend_string zend_string
struct _zend_array zend_array
ZEND_API zend_string * zend_string_concat2(const char *str1, size_t str1_len, const char *str2, size_t str2_len)
ZEND_API zend_string_init_interned_func_t zend_string_init_interned
Definition zend_string.c:31
#define ZSTR_VAL(zstr)
Definition zend_string.h:68
#define ZSTR_INIT_LITERAL(s, persistent)
#define ZSTR_LEN(zstr)
Definition zend_string.h:69
#define Z_TYPE_P(zval_p)
Definition zend_types.h:660
#define IS_PTR
Definition zend_types.h:624
struct _zend_array HashTable
Definition zend_types.h:386
#define Z_PTR_P(zval_p)
@ FAILURE
Definition zend_types.h:61
#define ZVAL_PTR_DTOR
zval * return_value
bool result
zval * ret
out($f, $s)