Skip to content

Instantly share code, notes, and snippets.

View Girgias's full-sized avatar
🐘

Gina Peter Banyard Girgias

🐘
View GitHub Profile
@Girgias
Girgias / output.txt
Last active January 23, 2020 12:23
Usage of "p" length modifier/format in php-src
george@DESKTOP-GEORGE-P:/mnt/c/Dev/php-src$ grep -rPbnH "(v)?(a)?s(n|l)?printf\(.*%(\+|-| |#|0)?(\d+|\*)?(\.(\d+|\*))?(p).*\)"
ext/mysqlnd/mysqlnd_vio.c:171:5443: hashed_details_len = mnd_sprintf(&hashed_details, 0, "%p", vio);
ext/opcache/jit/dynasm/minilua.c:698:21469:sprintf(buff,"%p",va_arg(argp,void*));
george@DESKTOP-GEORGE-P:/mnt/c/Dev/php-src$
george@DESKTOP-GEORGE-P:/mnt/c/Dev/php-src$ grep -rPbnH "(v)?s(tr)?pprintf\(.*%(\+|-| |#|0)?(\d+|\*)?(\.(\d+|\*))?(p).*\)"
sapi/phpdbg/phpdbg_list.c:351:11136: fake_name = strpprintf(0, "%s%c%p", filename, 0, op_array->opcodes);
sapi/phpdbg/phpdbg_prompt.c:543:16298: zend_string *source_path = strpprintf(0, "Standard input code%c%p", 0, PHPDBG_G(ops)->opcodes);
george@DESKTOP-GEORGE-P:/mnt/c/Dev/php-src$
@Girgias
Girgias / locale_aware_sprintf_calls.txt
Created January 15, 2020 15:58
Locale aware sprintf family calls in php-src (Format f, F, e, E, g, G, k, H)
Command: grep -rPbnH "(v)?(a)?s(n|l)?printf\(.*%(\+|-| |#|0)?(\d+|\*)?(\.(\d+|\*))?(f|F|e|E|g|G|k|H).*\)"
ext/fileinfo/libmagic/softmagic.c:751:19760: (void)snprintf(buf, sizeof(buf), "%g", vf);
ext/fileinfo/libmagic/softmagic.c:771:20167: (void)snprintf(buf, sizeof(buf), "%g", vd);
ext/mysqlnd/mysql_float_to_double.h:43:1713: sprintf(num_buf, "%.*f", decimals, fp4);
ext/opcache/jit/dynasm/minilua.c:145:3126:#define lua_number2str(s,n)sprintf((s),"%.14g",(n))
ext/pdo_firebird/firebird_statement.c:376:10371: *len = slprintf(*ptr, CHAR_BUF_LEN, "%.*F", -var->sqlscale, *(double*)var->sqldata);
ext/pdo_firebird/firebird_statement.c:384:10741: *len = slprintf(*ptr, CHAR_BUF_LEN, "-0.%0*" LL_MASK "d", -var->sqlscale, -n % f);
ext/pdo_firebird/firebird_statement.c:421:11909: *len = slprintf(*ptr, CHAR_BUF_LEN, "%F", *(float*)var->sqldata);
ext/pdo_firebird/firebird_statement.c:425:12083: *len = slprintf(*ptr, CHAR_BUF_LEN, "%F" , *(double*)var->sqldata);
@Girgias
Girgias / grep-custom-php-src-formats.txt
Last active January 15, 2020 15:25
Custom snprintf formats used in php-src
george@DESKTOP-GEORGE-P:/mnt/c/Dev/php-src$ grep -rPbnH "(v)?(a)?s(n|l)?printf\(.*%(\+|-| |#|0)?(\d+|\*)?(\.(\d+|\*))?(h|H|k|v|t|j|z|Z|l|L|I).*\)"
ext/bcmath/libbcmath/src/output.c:73:2220: snprintf(digits, sizeof(digits), "%ld", val);
ext/date/php_date.c:51:1925: int st = snprintf(s, len, "%lld", i); \
ext/date/php_date.c:840:35029: case 'Y': length = slprintf(buffer, sizeof(buffer), "%s%04lld", t->y < 0 ? "-" : "", php_date_llabs((timelib_sll) t->y)); break;
ext/date/php_date.c:915:38829: case 'U': length = slprintf(buffer, sizeof(buffer), "%lld", (timelib_sll) t->sse); break;
ext/date/tests/bug63435.phpt:8:146: $datetime = Datetime::createFromFormat("u", sprintf("%06ld", $i));
ext/ftp/ftp.c:1729:32954: eprtarg_len = snprintf(eprtarg, sizeof(eprtarg), "|2|%s|%hu|", out, ntohs(((struct sockaddr_in6 *) &addr)->sin6_port));
ext/imap/php_imap.c:1329:41542: snprintf(tmp + 6, sizeof(tmp) - 6, "%4ld) ", cache->msgno);
ext/imap/php_imap.c:1344:
@Girgias
Girgias / pandoc-docbook-implementations.txt
Last active November 7, 2019 00:53
Needed docbook tags support in Pandoc for PHP documentation.
{-
List of all DocBook tags, with [x] indicating implemented,
[o] meaning intentionally left unimplemented (pass through):
[N] are needed for the PHP documentation.
[?] are maybe needed for the PHP documentation.
Currently: 20 tags need support
8 tags maybe need support
@Girgias
Girgias / entity-counter.php
Last active March 19, 2019 19:09
PHPDoc-Entity-Counter version 0.1.1
<?php
/*
* TODO
* CLI options:
* - Language (default EN, Active Lang, All)
* - Output format
*
* Optional HTML output
*