Jump to content

rick645

Members
  • Posts

    107
  • Joined

  • Last visited

Recent Profile Visitors

2,227 profile views

rick645's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. > Because `E_DEPRECATED` can only be triggered by PHP itself, to indicate deprecated functionality in the PHP engine itself. For userland code (_including_ frameworks and libraries!) to trigger deprecation notices, you must use `E_USER_DEPRECATED`. > > BTW, you can add that to the `error_reporting` mask, too: > > ``` ini > error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_USER_DEPRECATED > ``` > _Originally posted by @weierophinney in [#98](https://github.com/zendframework/zend-mvc/issues/98#issuecomment-194395567)_ Anyway, it seems to me that by default E_USER_DEPRECATED is disabled. When (at what stage of development) do you usually prefer to keep it disabled? When do you usually prefer to enable it (error_reporting = ~E_USER_DEPRECATED & ...)? Maybe in pre-production/finishing stage?
  2. $ cat tick3.php <?php declare(ticks=3); function my_tick_function() { debug_print_backtrace(); } register_tick_function('my_tick_function'); abs(1); // added abs(1); // added abs(1); // added $ php tick3.php #0 /tmp/tmp.MLb8GRwmkU/tick3.php(6): my_tick_function() #0 /tmp/tmp.MLb8GRwmkU/tick3.php(8): my_tick_function() OK, thanks
  3. Granular level? ???? I don't understand ???? $ tree ├── tick1.php ├── tick2.php └── tick3.php $ cat tick1.php <?php declare(ticks=1); function my_tick_function() { debug_print_backtrace(); } register_tick_function('my_tick_function'); $ cat tick2.php <?php declare(ticks=2); function my_tick_function() { debug_print_backtrace(); } register_tick_function('my_tick_function'); $ cat tick3.php <?php declare(ticks=3); function my_tick_function() { debug_print_backtrace(); } register_tick_function('my_tick_function'); $ php tick1.php #0 /tmp/tmp.MLb8GRwmkU/tick1.php(5): my_tick_function() $ php tick2.php #0 /tmp/tmp.MLb8GRwmkU/tick2.php(5): my_tick_function() $ php tick3.php $ Why the php tick3.php command does not produce output?
  4. https://www.php.net/manual/it/function.register-tick-function.php Specifically https://www.php.net/manual/it/control-structures.declare.php#control-structures.declare.ticks Honestly, it's not very clear. Can someone explain it better?
  5. Here is the comparison echo "DIFF1: "; $diff = $dom->diff($x1Doc, $x2Doc); echo $diff->saveHTML(); echo "MERGE1: "; echo $dom->merge($x1Doc, $diff)->saveXML(); echo "DIFF2: "; $diff = $dom->diff($x2Doc, $x1Doc); echo $diff->saveHTML(); echo "MERGE2: "; echo $dom->merge($x1Doc, $diff)->saveXML(); Output DIFF1: <dm:diff xmlns:dm="http://www.locus.cz/diffmark"> <dm:delete> <aaa xxx1="aaa"> </aaa> </dm:delete> <dm:insert> <aaa xxx2="bbb"> </aaa> </dm:insert> </dm:diff> MERGE1: <?xml version="1.0"?> <aaa xxx2="bbb"> </aaa> DIFF2: <dm:diff xmlns:dm="http://www.locus.cz/diffmark"> <aaa xxx1="aaa" dm:update="aaa"> <dm:insert> <bbb> blabla1 </bbb> </dm:insert> <dm:copy count="1"> </dm:copy> </aaa> </dm:diff> MERGE2: <?xml version="1.0"?> <aaa xxx1="aaa"> <bbb> blabla1 </bbb> </aaa> Unfortunately I don't have time to comment on the differences. If anyone else wants to... Anyway Precisely.
  6. I agree XMLDiff is a class, and it works as a class should work IHMO <?xml version="1.0"?> <dm:diff xmlns:dm="http://www.locus.cz/diffmark"> <dm:delete> <aaa xxx1="aaa"/> </dm:delete> <dm:insert> <aaa xxx2="bbb"> </aaa> </dm:insert> </dm:diff> Of course, I would say yes
  7. Here's my scenario + ls -1 main.php x1.xml x2.xml + cat x1.xml <aaa xxx1="aaa"> <bbb> blabla1 </bbb> </aaa> + cat x2.xml <aaa xxx2="bbb"> </aaa> + cat main.php <?php $x1Doc = new DOMDocument(); $x1Doc->load('x1.xml'); $x2Doc = new DOMDocument(); $x2Doc->load('x2.xml'); $dom = new XMLDiff\DOM; $diff = $dom->diff($x1Doc, $x2Doc); echo $dom->merge($x1Doc, $diff)->saveXML(); Let's do some tests + php main.php <?xml version="1.0"?> <aaa xxx2="bbb"> </aaa> I was expecting something like this though <aaa xxx1="aaa" xxx2="bbb"> <bbb> blabla1 </bbb> </aaa> Any suggestions?
  8. $ cat Dockerfile FROM php:8.2 RUN apt-get update \ && apt-get -y install php8.2-xml $ docker build . [+] Building 6.7s (5/5) FINISHED docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 109B 0.0s => [internal] load metadata for docker.io/library/php:8.2 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => CACHED [1/2] FROM docker.io/library/php:8.2 0.0s => ERROR [2/2] RUN apt-get update && apt-get -y install php8.2-xml 6.5s ------ > [2/2] RUN apt-get update && apt-get -y install php8.2-xml: 0.349 Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB] 0.477 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB] 0.533 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [47.9 kB] 0.585 Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8792 kB] 4.158 Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [13.5 kB] 4.168 Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [241 kB] 5.182 Fetched 9301 kB in 5s (1881 kB/s) 5.182 Reading package lists... 5.746 Reading package lists... 6.326 Building dependency tree... 6.472 Reading state information... 6.480 Package php8.2-xml is not available, but is referred to by another package. 6.480 This may mean that the package is missing, has been obsoleted, or 6.480 is only available from another source 6.480 6.484 E: Package 'php8.2-xml' has no installation candidate ------ Dockerfile:2 -------------------- 1 | FROM php:8.2 2 | >>> RUN apt-get update \ 3 | >>> && apt-get -y install php8.2-xml 4 | -------------------- ERROR: failed to solve: process "/bin/sh -c apt-get update && apt-get -y install php8.2-xml" did not complete successfully: exit code: 100 Why?
  9. Ok, but, details aside, do you have any solution?
  10. $ docker login -u blabla... Password: WARNING! Your password will be stored unencrypted in /home/rino/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credential-stores Login Succeeded $ docker build . RUN apt-get update \ && apt-get -y install php-xml blabla... 7.782 E: Package 'php-xml' has no installation candidate More precisely? More precisely?
  11. + /usr/bin/docker run --rm php:8.2 \ php -r "echo XMLDiff\File::merge();" Fatal error: Uncaught Error: Class "XMLDiff\File" not found in Command line code:1 mmmhhh... Perhaps the appropriate extension must be installed (it should be php8.2-xml). So let's do this + cat Dockerfile FROM php:8.2 RUN apt-get update \ && apt-get -y install php8.2-xml \ && docker-php-ext-install php8.2-xml \ && docker-php-ext-enable php8.2-xml + /usr/bin/docker build -t test . [+] Building 7.4s (5/5) FINISHED docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 196B 0.0s => [internal] load metadata for docker.io/library/php:8.2 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => CACHED [1/2] FROM docker.io/library/php:8.2 0.0s => ERROR [2/2] RUN apt-get update && apt-get -y install php8.2-xml && docker-php-ext-install php8.2-xml 7.3s ------ > [2/2] RUN apt-get update && apt-get -y install php8.2-xml && docker-php-ext-install php8.2-xml && docker-php-ext-enable php8.2-xml: 0.342 Get:1 http://deb.debian.org/debianbookworm InRelease [151 kB] 0.469 Get:2 http://deb.debian.org/debianbookworm-updates InRelease [55.4 kB] 0.539 Get:3 http://deb.debian.org/debian-securitybookworm-security InRelease [48.0 kB] 0.597 Get:4 http://deb.debian.org/debianbookworm/main amd64 Packages [8792 kB] 4.851 Get:5 http://deb.debian.org/debianbookworm-updates/main amd64 Packages [13.5 kB] 4.861 Get:6 http://deb.debian.org/debian-securitybookworm-security/main amd64 Packages [241 kB] 5.883 Fetched 9301 kB in 6s (1653 kB/s) 5.883 Reading package lists... 6.445 Reading package lists... 7.019 Building dependency tree... 7.167 Reading state information... 7.175 Package php8.2-xml is not available, but is referred to by another package. 7.175 This may mean that the package is missing, has been obsoleted, or 7.175 is only available from another source 7.175 7.179 E: Package 'php8.2-xml' has no installation candidate ------ Dockerfile:3 -------------------- 2 | 3 | >>> RUN apt-get update \ 4 | >>> && apt-get -y install php8.2-xml \ 5 | >>> && docker-php-ext-install php8.2-xml \ 6 | >>> && docker-php-ext-enable php8.2-xml 7 | -------------------- ERROR: failed to solve: process "/bin/sh -c apt-get update && apt-get -y install php8.2-xml && docker-php-ext-install php8.2-xml && docker-php-ext-enable php8.2-xml" did not complete successfully: exit code: 100 Why? Obviously, consequently + /usr/bin/docker run test \ php -r "echo XMLDiff\File::merge();" Unable to find image 'test:latest' locally docker: Error response from daemon: pull access denied for test, repository does not exist or may require 'docker login': denied: requested access to the resource is denied. So, how do you install the php8.2-xml extension?
  12. Of course, to keep the global namespace in order, it would be preferable to encapsulate everything in a function main(), front_controller(), etc., and call it.
  13. Nor is it convenient to always return all the output in the end, and then print it all in one fell swoop. Often, in fact, as already mentioned, it is a good thing to have intermediate outputs (avoiding embarrassing mute scenes), to understand what the software is doing running (also respecting the time sequence) fwrite($outputStream, “Downloading...\n”); // do something fwrite($outputStream, “Unpacking...\n”); // do something fwrite($outputStream, “Install...\n”); // do something What do you think?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.